Sonar RuleSet
Par Sébastien Bordes le mercredi 19 octobre 2011, 09:19 - Intégration Continue - Lien permanent
Today I decide to share my Sonar Source ruleset that I use for JavaFX 2.0 project (JRebirth.org), because global quality greatly depends on rules used.
My Sonar instance is accessible here quality.jrebirth.org
Recently I update the default ruleset and the quality index decrease from 98.7% to only 10% !
Here you can see the project timeline view which illustrate well the impact of the new ruleset !!
I activate all rules Pmd,Checkstyle,FindBugs (721) excepts :
- At Least One Constructor - Pmd
Sometimes it could be a waste of time to write empty default constructor.
- Bean Members Should Serialize - Pmd
Sometimes we don't want to provide a setter, (workaround is to set the property transient, but every object is not a bean specifically in UI)
- Default Package - Pmd
it could be useful to reduce visibility to current package, to not share public API
- Header - Checkstyle
Broken
- Illegal Catch - Checkstyle
In order to manage Jdk7 Multicatch
- Javadoc Package - Checkstyle
Who write javadoc for package in a dedicated file ?
- Magic Number - Checkstyle
When writing UI there is a lot of magic numbers needed.
- Missing Constructor - Checkstyle
See above At Least One Constructor
- Regexp - Checkstyle
Broken
- Regexp Header - Checkstyle
Broken
- Regexp Multiline - Checkstyle
Broken
- Regexp Singleline - Checkstyle
Broken
- Regexp Singleline Java - Checkstyle
Broken
- Short Variable - Pmd
When I work with a bean named Car I'm used to name variable c, to be homogenous with long name like NotificationType nt
- XPath rule template - Pmd
Broken
You can download my active rules : Sonar Active RuleSet and my inactive rules : Sonar Inactive RuleSet
Let me know what do you think about them !
Later I will share my dedicated xml configuration files for CheckStyle, Pmd and FindBugs
