Sonarqube web ui needs a filter for rule scope (all, main, test)


we recently had some questions about which rules are applied to test classes.
The first answer from Sonarsource support was that only the rules with the tag ‘test’ are checked.

But then with further builds we noticed, there were also issues when the quality profiles has no rules with tag ‘test’, means more questions …

From support we learned there are 3 categories for rules

  • ALL - executed on Main and Test code
  • MAIN - execute only on Main code
  • TEST - executed only on Test code

but right now the only way to get all rules for a scope is via web api, e.g.
Then parse the json for the desired scopes

The Sonarqube web ui needs an additional filter for the rule scope, to see when a rule is applied.
This will be even more important, when it will be possible to refine list of test rules, see