Rule only for New code

Make sure to tell us:

  • What version are you upgrading from?
  • System information (Operating system, Java version, Database provider/version)
  • What’s the issue you’re facing?

Hello Team,

We want to apply a new rule via Quality profile in a project only for new code not for overall code. Is it possible? Or sonarqube does not allow to implement for only new code, it has to be for overall code?



Rules run on all code. The way to enforce this would be through Quality Gate conditions. No, you can’t add a condition that rules XXX not be broken. But you can add conditions on issue metrics, such as count of Bugs / Vulnerabilities / etc. on New Code or by severity.