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

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 name/path
  • By line or range of lines
  • By file content (since version 1.2)

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

Exclusion patterns can be specified at both global and project levels. Go to Configuration > General Settings > Switch Off Violations (or at project level: Configuration > Settings > Switch Off Violations) and set the 'sonar.switchoffviolations.patterns' property:

  • A line can have the following formats:
    • A semi-colon separated string defining 3 parts: resource key pattern, rule key pattern and range of lines.
    • A semi-colon separated string defining 2 parts: a first regular expression and a second one, which will be used to determine blocks of code for which violations must be ignored
      • Note: if the first regular expression is found but not the second one, then the plugin considers that the end of the code block is the end of the file.
    • A single string defining a regular expression which will be used to determine files that should be ignored if they match this regular expression
  • Comments start with #
  • Blank lines are allowed

 

Examples

Usage

Run a Sonar analysis on your project to take into account your configuration.

Change Log

Release 1.3 (2 issues)
Type Key Summary Priority
New Feature SONARPLUGINS-1370 Add an administration console to the Switch Off Violation Plugin Major
Improvement SONARPLUGINS-2299 Simplify the description of the 'sonar.switchoffviolations.patterns' property Minor

 

Release 1.2 (3 issues)
Type Key Summary Priority
Task SONARPLUGINS-1990 Fix URL for update center Major
Improvement SONARPLUGINS-1104 Add a way to exclude files from analysis based on file content Major
Bug SONARPLUGINS-2077 Typo in the Configuration file for exclusion patterns description Trivial

 

Release 1.1 (1 issues)
Type Key Summary Priority
Improvement SONARPLUGINS-1202 The plugins settings should be moved from the file based configuration to Project Setting page Major

Labels
  • None