Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
SonarQube
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<table class="wysiwyg-macro" data-macro-name="unmigrated-inline-wiki-markup" data-macro-parameters="atlassian-macro-output-type=BLOCK" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e3VubWlncmF0ZWQtaW5saW5lLXdpa2ktbWFya3VwOmF0bGFzc2lhbi1tYWNyby1vdXRwdXQtdHlwZT1CTE9DS30&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>{iframe:src=http://update.sonarsource.org/plugins/switchoffviolations.html|width=700|height=250|frameborder=0} Your browser does not support iframes. {iframe}</pre></td></tr></table><h1>Description / Features</h1><p>This plugin is used to exclude some issues in a fine-grained way. It allows to define some exclusion patterns to switch off issues:</p><ul><li>By rule</li><li>By file name/path</li><li>By line or range of lines</li><li>By file content</li></ul><h1>Installation</h1><ol><li>Install the plugin through the <a href="http://docs.codehaus.org/display/SONAR/Update+Center" rel="nofollow">Update Center</a> or download it into the <em>SONARQUBE_HOME/extensions/plugins</em> directory</li><li>Restart the SonarQube server</li></ol><h1>Configuration</h1><p>Exclusion patterns can be specified at both global and project levels. Go to Settings > Configuration > General Settings > Switch Off Violations (or at project level: Configuration > Settings > Switch Off Violations) and add exclusion patterns to the following properties:</p><ul><li><strong>File exclusion patterns</strong> (<code>sonar.switchoffviolations.allfile</code>) to switch off all the issues on files that contains a block of code that matches a given regular expression.<br /><ul><li>Example: switch off all the issues on files containing <code>@javax\.annotation\.Generated</code><br /><img class="confluence-embedded-image" confluence-query-params="effects=drop-shadow" src="/download/attachments/231082320/file-exclusions-patterns.png?version=1&modificationDate=1371633922959&effects=drop-shadow" data-image-src="/download/attachments/231082320/file-exclusions-patterns.png?version=1&modificationDate=1371633922959&effects=drop-shadow" data-linked-resource-id="231377087" data-linked-resource-type="attachment" data-linked-resource-default-alias="file-exclusions-patterns.png" data-base-url="http://docs.codehaus.org" data-linked-resource-container-id="231082320" title="null > file-exclusions-patterns.png"></li></ul></li><li><strong>Bloc exclusion patterns </strong>(<code>sonar.switchoffviolations.block</code>) to switch off issues on specific blocks of code. 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.</li></ul><ul><li style="list-style-type: none;"><ul><li>Example: exclude code blocks delimited by <code>GEN-FIRST</code> and <code>GEN-LAST</code> (like NetBeans auto-generated code):<br /><img class="confluence-embedded-image" width="900" confluence-query-params="effects=drop-shadow" src="/download/attachments/231082320/bloc-exclusions-patterns.png?version=1&modificationDate=1371633922949&effects=drop-shadow" data-image-src="/download/attachments/231082320/bloc-exclusions-patterns.png?version=1&modificationDate=1371633922949&effects=drop-shadow" data-linked-resource-id="231377086" data-linked-resource-type="attachment" data-linked-resource-default-alias="bloc-exclusions-patterns.png" data-base-url="http://docs.codehaus.org" data-linked-resource-container-id="231082320" title="null > bloc-exclusions-patterns.png"></li></ul></li></ul><div><ul><li><span style="color: rgb(68,68,68);"><strong>Multi-criteria exclusion patterns </strong>(</span><code>sonar.switchoffviolations.multicriteria</code>) to switch off issues on specific resources, rules and ranges of lines.<br /><ul><li>Examples: <br /><ul><li>Switch off all the issues (Java projects: structure = packages) => <code>*;*;*</code></li><li>Switch off all the issues (non-Java projects: structure = folders) => <code>**/*;*;*</code></li><li>Exclude all the issues on the Java file <code>com.foo.Bar</code> => <code>com.foo.Bar;*;*</code></li><li>Exclude all the issues on the Java package <code>com.foo</code> => <code>com.foo.*;*;*</code></li><li>Exclude all the issues of a specific rule => <code>*;checkstyle:com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck;*</code></li><li>Exclude all the issues of a specific rule on a specific file => <code>com.foo.Bar;checkstyle:com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck;*</code></li><li>Exclude all the issues on specific lines 10, 25 and 90 => <code>com.foo.Bar;*;[10,25,90]</code></li><li>Exclude all the issues on a range of lines => <code>com.foo.Bar;*;[10-90]</code></li><li>Exclude all the issues on several ranges of lines => <code>com.foo.Bar;*;[10-90,92,98,120-150]<br /> <img class="confluence-embedded-image" confluence-query-params="effects=drop-shadow" src="/download/attachments/231082320/multi-criteria-exclusion-patterns.png?version=1&modificationDate=1371633922935&effects=drop-shadow" data-image-src="/download/attachments/231082320/multi-criteria-exclusion-patterns.png?version=1&modificationDate=1371633922935&effects=drop-shadow" data-linked-resource-id="231377085" data-linked-resource-type="attachment" data-linked-resource-default-alias="multi-criteria-exclusion-patterns.png" data-base-url="http://docs.codehaus.org" data-linked-resource-container-id="231082320" title="null > multi-criteria-exclusion-patterns.png"></code></li></ul></li></ul></li></ul><table class="wysiwyg-macro" data-macro-name="info" data-macro-parameters="title=Versions prior to 1.3" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2luZm86dGl0bGU9VmVyc2lvbnMgcHJpb3IgdG8gMS4zfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"><p>Set the <code>sonar.switchoffviolations.patterns</code> property:</p><table class="wysiwyg-macro" data-macro-name="code" data-macro-parameters="language=none|title=Examples" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6dGl0bGU9RXhhbXBsZXN8bGFuZ3VhZ2U9bm9uZX0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre># Switch off all issues (Java projects: structure = packages) *;*;* # Exclude a specific rule *;checkstyle:com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck;* # Exclude on several ranges of lines com.foo.Bar;*;[10-90,92,98,120-150] # Exclude code blocks delimited by GEN-FIRST and GEN-LAST (like NetBeans auto-generated code) GEN-FIRST;GEN-LAST # Exclude files containing "@javax.annotation.Generated" @javax\.annotation\.Generated</pre></td></tr></table></td></tr></table><h1>Usage</h1></div><p>Run an analysis on your project to take into account your configuration.</p><h1>Change Log</h1><p><img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2ppcmFpc3N1ZXM6YW5vbnltb3VzPXRydWV8dGl0bGU9UmVsZWFzZSAxLjN8cmVuZGVyTW9kZT1zdGF0aWN8d2lkdGg9OTAwfGNvbHVtbnM9dHlwZTtrZXk7c3VtbWFyeTtwcmlvcml0eXx1cmw9aHR0cDovL2ppcmEuY29kZWhhdXMub3JnL3NyL2ppcmEuaXNzdWV2aWV3czpzZWFyY2hyZXF1ZXN0LXhtbC90ZW1wL1NlYXJjaFJlcXVlc3QueG1sP2pxbFF1ZXJ5PXByb2plY3QrJTNEK1NPTkFSUExVR0lOUytBTkQrZml4VmVyc2lvbislM0QrJTIyU1dJVENILU9GRi1WSU9MQVRJT05TLTEuMyUyMitPUkRFUitCWStwcmlvcml0eStERVNDJnRlbXBNYXg9MTAwMH0&locale=en_GB&version=2" data-macro-name="jiraissues" data-macro-parameters="anonymous=true|columns=type;key;summary;priority|renderMode=static|title=Release 1.3|url=http://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery\=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+%22SWITCH-OFF-VIOLATIONS-1.3%22+ORDER+BY+priority+DESC&tempMax\=1000|width=900"></p><p> </p><p><img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2ppcmFpc3N1ZXM6YW5vbnltb3VzPXRydWV8dGl0bGU9UmVsZWFzZSAxLjJ8cmVuZGVyTW9kZT1zdGF0aWN8d2lkdGg9OTAwfGNvbHVtbnM9dHlwZTtrZXk7c3VtbWFyeTtwcmlvcml0eXx1cmw9aHR0cDovL2ppcmEuY29kZWhhdXMub3JnL3NyL2ppcmEuaXNzdWV2aWV3czpzZWFyY2hyZXF1ZXN0LXhtbC90ZW1wL1NlYXJjaFJlcXVlc3QueG1sP2pxbFF1ZXJ5PXByb2plY3QrJTNEK1NPTkFSUExVR0lOUytBTkQrZml4VmVyc2lvbislM0QrJTIyU1dJVENILU9GRi1WSU9MQVRJT05TLTEuMiUyMitPUkRFUitCWStwcmlvcml0eStERVNDJnRlbXBNYXg9MTAwMH0&locale=en_GB&version=2" data-macro-name="jiraissues" data-macro-parameters="anonymous=true|columns=type;key;summary;priority|renderMode=static|title=Release 1.2|url=http://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery\=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+%22SWITCH-OFF-VIOLATIONS-1.2%22+ORDER+BY+priority+DESC&tempMax\=1000|width=900"></p><p> </p><p><img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2ppcmFpc3N1ZXM6YW5vbnltb3VzPXRydWV8dGl0bGU9UmVsZWFzZSAxLjF8cmVuZGVyTW9kZT1zdGF0aWN8d2lkdGg9OTAwfGNvbHVtbnM9dHlwZTtrZXk7c3VtbWFyeTtwcmlvcml0eXx1cmw9aHR0cDovL2ppcmEuY29kZWhhdXMub3JnL3NyL2ppcmEuaXNzdWV2aWV3czpzZWFyY2hyZXF1ZXN0LXhtbC90ZW1wL1NlYXJjaFJlcXVlc3QueG1sP2pxbFF1ZXJ5PXByb2plY3QrJTNEK1NPTkFSUExVR0lOUytBTkQrZml4VmVyc2lvbislM0QrJTIyU1dJVENILU9GRi1WSU9MQVRJT05TLTEuMSUyMitPUkRFUitCWStwcmlvcml0eStERVNDJnRlbXBNYXg9MTAwMH0&locale=en_GB&version=2" data-macro-name="jiraissues" data-macro-parameters="anonymous=true|columns=type;key;summary;priority|renderMode=static|title=Release 1.1|url=http://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery\=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+%22SWITCH-OFF-VIOLATIONS-1.1%22+ORDER+BY+priority+DESC&tempMax\=1000|width=900"></p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced