Coding rules mapping
Sonar has its own classification of the coding rules. Currently Sonar manages 5 levels of activation for the rules : blocker, critical, major, minor and info. Since existing coding rules engines use their own levels, this page intends to describe the mapping between those and Sonar levels.
Checkstyle
Checkstyle uses 3 levels of severity : error, warning and info.
Import into Sonar
Checkstyle |
Sonar |
|---|---|
error |
blocker |
warning |
major |
info |
info |
any rule not present or with an inactive level in the checkstyle.xml file during an import into Sonar will not be activated |
Export out of Sonar
Sonar |
Checkstyle |
|---|---|
blocker or critical |
error |
major |
warning |
minor or info |
info |
any rule not activated in Sonar will not be present in the Checkstyle.xml definition file resulting of an export |
PMD
PMD uses 5 levels of priority, from 1 to 5
Import into Sonar
PMD |
Sonar |
|---|---|
1 |
blocker |
2 |
critical |
3 |
major |
4 |
minor |
5 |
info |
any rule not present in the PMD.xml file during an import into Sonar will not be activated |
Export out of Sonar
Sonar |
PMD |
|---|---|
blocker |
1 |
critical |
2 |
major |
3 |
minor |
4 |
info |
5 |
any rule not activated in Sonar will not be present in the PMD.xml definition file resulting of an export |
Findbugs
Findbugs uses 3 levels of priority, from 1 to 3
Import into Sonar
Findbugs |
Sonar |
|---|---|
1 |
blocker |
2 |
major |
3 |
info |
any rule not present in the Findbugs.xml file during an import into Sonar will not be activated |
Export out of Sonar
Logically, here is what we should have...
Sonar |
PMD |
|---|---|
blocker or critical |
1 |
major |
2 |
minor or info |
3 |
any rule not activated in Sonar will not be present in the Findbugs.xml definition file resulting of an export |
However, due to some strange behavior of Findbugs, Sonar does not set any priority in Findbugs when exporting. Otherwise some rules are not working.
