I am trying to find a better alternative to the default java quality profile "Sonar way with Findbugs".
Among the 516 rules of the profile, some of them are not actually set up properly (priority or activation).
For example:
As I could not find any ready-to-use set of rules better than the default one, I would like to get feedback on this topic from experienced Sonar users.
My experience (I'm using SQ since its first release in 3 different companies, wrote 130+ custom checks over the years) is the following:
Then each time "SonarQube Way" evolves you can easily update it, then compare it with P1.
You can do exactly the same using "SonarQube Way with Findbugs" profile (but I wouldn't do it as this enables lots of rules...)
Always keep in mind that it's better to have fewer rules you can explain and all developers are willing to apply instead of having lots of checks that are difficult to explain, nobody believes in and nobody wants to apply, nor read SQ anymore due to the huge amount of checks. In other words, start small and grow with your fellow developers.
Also remember that issues that are not fixed (and nobody wants to fix due to the fact that he rule raises too many false positives, is difficult to understand, etc) are a debt that is difficult to get rid of. This is a leak that will always bring more debt mostly because people are not ready to hear about such issues. It's better in such a context to deactivate these rules and bring them back later, when people are ready to talk about them and apply them.
Last but not least. Agree with the development teams on quality profiles release dates. Lets say for instance that you agree on the fact that there will be two profile updates per year. Between two profile releases people are welcome to discuss the rules, but these will not be modified until next release, if a modification is wanted (addition/ deletion of rules), it has to be discussed and a consensus has to be found. If a project starts between two releases it starts with current profile and uses it. When the profile is updated, your projects may have one release to align their code with the new rules, or if you use the "fix the leak" approach, projects agree that new code as well as refactored code will follow the new profiles.
Remember that if you're the owner of the profiles, your developers should be the ones asking for new rules to be added (this is a good KPI by the way.)
There is a lot more to say about this, but this should be a good starting point in order to help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With