SonarQube - yibinericxia/documents GitHub Wiki

Overview

It is a tool performing static code analysis.

Exclude Coverage

Use sonar.exclusions

sonar.sources=src
sonar.tests=tests
sonar.exclusions=**/node_modules/**,src/main.ts,**/*.spec.js,public/**

Exclude Violations

Use //NOSONAR at the end of the line

  • Do not use it unless you really disagree with SonarQube reports and add reasons after it.

Use @SuppressWarnings("$ruleKey")

  • Get the $ruleKey from the violation link in SonarQube UI, such as java:S1068 as shown below.

Use sonar-project.properties

  • Get the ruleKey from the violation link in SonarQube UI
sonar.issue.ignore.multicriteria=e1

sonar.issue.ignore.multicriteria.e1.ruleKey=java:S1068
sonar.issue.ignore.multicriteria.e1.resourceKey=**/model/*.java

References