When we test disabling a specific rule (see attached screenshot), this does not seem to work.
Code that breaches the rule (whether existing or newly introduced) is still being flagged.
We would like to get this working, as we will need to be able to disable some rules
that don’t make sense for our codebase, and for which we don’t want issues raised.
Version: SonarQube Developer Edition Version 8.3.1 (build 34397), generic SonarScanner (Java).
Thanks for your post and welcome to the community
If you want to disable rules right across your codebase then using Quality Profiles is much simpler and much more traceable than using the exclusion mechanism. You can simply create a copy of the Quality Profile you’re currently using then remove S116 and other unwanted rules.
I hope this helps; feel free to reply if you have any questions after reading through the documentation and experimenting with your own setup.
Thanks Cameron, using Quality Profiles worked.
I’m now not sure in what scenario “Restricting scope of coding rules” is meant to work. My reading of that documentation is that what I did should have resulted in that rule being excluded, but it didn’t.
It might be worth adding a link to the “Quality Profiles” documentation on that page, so people know there is an alternative.
Thanks for your help and prompt reply
Happy that you got Quality Profiles working. They’re the main customisation mechanism for managing rules globally which is why they’re in the top-level menu; most users don’t need the configuration you were using.
On the question of why your original method didn’t work, you were using the mechanism to apply only designated rules to certain files: “restrict the application of a rule to only certain components, ignoring all others”. The other section of this page, Ignore Issues on Multiple Criteria, would have achieved what you wanted, but Quality Profiles are a far better mechanism for this.
Thanks Cameron, that’s clearer. I got confused because all of the other examples in that document were about ignoring certain things (files, issues etc.), and I thought that specific setting was about ignoring specific rules.
Quality profiles are working well now