Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Icon

This plugin is not released yet.

Description

This plugin is used to exclude some violations in a fine-grained way. It allows to list some exclusion patterns to :

  • Switch off any violations on a line
  • Switch off a specific violation on a line
  • Switch off any violations on a range of lines
  • Switch off a specific violation on a range of lines

Configuration

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.

No settings are required in administration consoles. The only required property "sonar.switchoffviolations.configFile" must be set during project analysis. It is the path to the configuration file described in the next section.

Examples :

  • command-line parameter:
    -Dsonar.switchoffviolations.configFile=/path/to/config
  • Maven property in pom.xml :
    <properties>
      <sonar.switchoffviolations.configFile>${project.basedir}/violations-filter.txt</sonar.switchoffviolations.configFile>
    </properties>
    

Patterns

Comments start with #. Blank lines are allowed. A line defines 3 fields: resource key, rule key and range of lines.

# suppress all violations
*;*;*

# exclude the Java file com.foo.Bar
com.foo.Bar;*;*

# exclude a Java package
com.foo.*;*;*

# exclude a specific rule
*;checkstyle:IllegalRegexp;*

# exclude a specific rule on a specific file
com.foo.Bar;checkstyle:IllegalRegexp;*

# exclude on specific lines 10, 25 and 90
com.foo.Bar;*;[10,25,90]

# exclude on a range of lines
com.foo.Bar;*;[10-90]

# exclude on many ranges of lines
com.foo.Bar;*;[10-90,92,98,120-150]
  • No labels