Deactivate rule in inherited profile

It would be nice if we can deactivate specific rules in inherited profile.

Let’s assume that we have COMPANY profile and PROJECT1 + PROJECT2 profiles inheriting from it.

Let’s assume that there is RULE in COMPANY profile, this rule makes sense in PROJECT1 but not in PROJECT2.

Ideally we would like to deactivate RULE in PROJECT2.

Currently there are 2 workarounds possible:

  • We can change RULE severity to INFO and treat such issues as to be ignored, but this is not ideal as INFO issues still keep showing
  • We can stop using profile inheritance, but this is not ideal since in other scenarios rule inheritance is beneficial

Is INFO workaround the right approach?

Or should there be deactivate button in new SonarQube version?

Thanks for your feedback.
Ondrej Lerch

We would also like to have this feature.

For our legacy projects lots of rules from SonarWay we want to inherit (and get updated rules with SonarQube updates without any effort), but some rules are completely off from our existing cooding style. These we would like to disable.

IMHO the Info workaround isn’t the way to go.

Very much agree with @milbrandt - if, for example, we want all of the Sonar Way rules except one, it makes sense to be able to inherit that profile and then negate the one rule we don’t want.

This is much preferable to the other option of creating a static copy of the ruleset, which creates an additional maintenance overhead every time Sonar Way is updated.

3 Likes