This plugin is used to exclude some violations in a fine-grained way. It allows to define some exclusion patterns to switch off violations :
- By rule
- By file
- By line or range of lines
Download the plugin from Update Center and restart server.
If you don't have access to Internet, then manually download JAR file into $SONAR_HOME/extensions/plugins and restart server.
The configuration of the plugin is done in the Web admin console, where you can specify the exclusion patterns in the textarea (one per line):
- Comments start with #
- Blank lines are allowed
- A line defines 3 fields: resource key, rule key and range of lines.
Note 1: prior to version 1.1, the only way to specify exclusions was to write them in a file and fill the "sonar.switchoffviolations.configFile" property with the location of that file. This feature is still supported, even if it is best to use the Web admin console to configure the plugin.
Note 2: when specifying exclusions patterns in the Web admin console, you may be surprised to see that several lines are displayed on a single line after you have saved your modifications. This is a known bug which doesn't affect the property you have set but only the way it is displayed when your property do not exceed 50 characters. If you want to see the line returns, then just add a long comment at the beginning (e.g. "# This is a comment blablabla"), and after you saved, you will see your property correctly formatted.