Question

I am trying to create new rules profile in Sonar 2.9 with my checkstyle rules xml. When I try to import a checkstyle rules file with suppression filter configured, sonar gives me following messages:

Profile 'test2' created. Set it as default or link it to a project to use it for next measures.   [hide]
Checkstyle filters are not imported: SuppressionCommentFilter
Checkstyle filters are not imported: SuppressionFilter   [hide]

I am not bothered about SuppressionCommentFilter for now, but how to enable SuppressionFilter? If it is not possible, is there any other way to have a similar functionality of excluding specific files from specific checks in Sonar?

Was it helpful?

Solution

You can set the Suppression(Comment)Filters manually: Go to Configuration -> General Settings -> Java -> CheckStyle. There's an input box. Paste the <module> definition from your checkstyle.xml file into the input box. Relative paths are interpreted from the .sonar folder. This feature is present in your 2.9, I think it was added on 2.3.

For all my purposes, this feature was sufficient. To my knowledge, it is not possible to actually import the filter module definitions. Might be a newer version of Sonar can do it though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top