Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: SWITCH-OFF-VIOLATIONS-1.2
-
Component/s: Switch off violations
-
Labels:None
-
Number of attachments :
Description
I saw the description for the upcoming 'switch off violations' plugin (http://docs.codehaus.org/display/SONAR/Switch+Off+Violations+Plugin). It would be nice to have a dynamic way of excluding files or suppress violations based on file content.
We have several projects containing a lot of generated code which we would like to exclude from analysis. Since the code is generated from models, "static" exclude patterns with given package or file patterns are not helpful: file and package names can change from release to release for a given project / file and package names are different from project to project using the generator. It would be therefore nice to be able to specify a "content marker" instead of a file / package name pattern to exclude a file (e. g. exclude file from analysis if it contains '@generated' in the header).
I'm not sure if this should be a feature for sonar itself or for the "switch off violations plugin". As far as I understand, the purpose of the 'switch off plugin' is the suppression of violations. However, in our case, excluding files altogether effectively removing them from any metric would be preferable.
Issue Links
- is duplicated by
-
SONARPLUGINS-1652
Switch off violations on BLOCKS of code based on block-start and block-end REGEX
-
Exclusion of specific violations based on the content in a file is the feature i am looking for.
I don't want to end-up setting each and every unwanted violation as a 'false positive'. Looking for a global content patttern matcher exclusion filter to switch off violation lets say 'unused private field' for specific instances in old java code which cannot be changed now (we have some constants auto-generated by the templated during the initial creation of the file years ago, and there are hundreds of them)
Can we have 'content based regex' filter for the switchoff violations plugin?