Issue Details (XML | Word | Printable)

Key: SONAR-280
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Simon Brandhof
Reporter: Nicolas Rougé
Votes: 6
Watchers: 5
Operations

If you were logged in you would be able to see more operations.
Sonar

Enable CheckStyle SuppressionCommentFilter module

Created: 19/Jun/08 02:53 AM   Updated: 22/Dec/09 09:23 AM   Resolved: 27/Apr/09 05:08 AM
Component/s: Checkstyle, Coding Rules
Affects Version/s: 1.1, 1.2, 1.2.1, 1.3
Fix Version/s: 1.9

Time Tracking:
Original Estimate: 4 hours
Original Estimate - 4 hours
Remaining Estimate: 4 hours
Remaining Estimate - 4 hours
Time Spent: Not Specified
Time Spent - Not Specified

Issue Links:
Related
 


 Description  « Hide

The CheckStyle SuppressionCommentFilter module should be handled by Sonar, since it allows the developers to suppress some CheckStyle rule violations in the code using a commentary.
For your information, it is always possible to suppress some PMD rule violations in the code using @SuppressWarnings annotation, but for CheckStyle, this functionality does not use annotation but tags in single comment lines, and is not available by default.

With the SuppressionCommentFilter module activated in CheckStyle, the XML file should be generated with:

<module name="Checker">
...
<module name="SuppressionCommentFilter"/>
<module name="TreeWalker">
<module name="FileContentsHolder" />
...
</module>
</module>

It'll great if we can also setup the properties of this filter.



Simon Brandhof added a comment - 19/Jun/08 06:46 AM

What a shame that checkstyle does not manage the standard way used by PMD. This is a recurrent need wanted for sonar (see SONAR-208). We keep it actively in mind for next releases.


Freddy Mallet added a comment - 01/Nov/08 02:31 PM

Simon, can't we imagine to define a boolean option on Sonar Chectyle Plugin to handle this feature ?


Dominique Jean-Prost added a comment - 22/Apr/09 04:51 AM

To my mind, if it's not complicated to implement, it should be added as quick as possible.
In my case, it prevents me to use the checktyle file generated by sonar in eclipse or maven plugin. The consequence is that when I change something in my checkstyle rules, I have to do it twice : in sonar, and in my external checkstyle file (used by eclipse and maven plugin).


Freddy Mallet added a comment - 22/Apr/09 07:00 AM

In Sonar 1.9, we'll handle only the default behavior by adding the following line in the checkstyle configuration file

<module name="SuppressionCommentFilter"/>

So rules violations between a comment containing CHECKSTYLE:OFF and a comment containing CHECKSTYLE:ON will be ignore :

//CHECKSTYLE:OFF
      int toto = tata;
      toto.myCheckstyleError();    
//CHECKSTYLE:ON

Dominique Jean-Prost added a comment - 22/Apr/09 07:09 AM

that's ok for me