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 17 Next »

Description / Features

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

Installation

  1. Install the Switch Off Violations plugin through the Update Center or download it into the SONAR_HOME/extensions/plugins directory
  2. Restart the Sonar server

Configuration

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.

Example:

# suppress all violations
*;*;*

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

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

# exclude a specific rule
*;checkstyle:com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck;*

# exclude a specific rule on a specific file
com.foo.Bar;checkstyle:com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck;*

# 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]

Known Limitation

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 saving your modifications. This is a known issue which doesn't affect the property you have set but only the way it is displayed when your property does 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.

Changelog

Loading

Release 1.1 (1 issues)

  • No labels