Configure a rule in SonarQube to ignore a certain class

Enter the SonarQube homepage of the project, as shown in the figure:

 

Enter a certain module to be set, for example, to set a certain file in ****-core, click the NAME link on the previous page to enter the page, as shown in the figure:

 
Select Administration-->General Settings-->Analysis Scope, as shown in the figure:


 

Enter the Issues of Analysis Scope (on the right side, not the top Issues), find Ignore Issues on Multiple Criteria (ignore some rules on some issues), and fill in the key value of the rule to be ignored: RULE KEY PATTERN , the file path to be used: FILE PATH PATTERN (the file path is the full path), click Add Value , save the Save Issues Settings configuration as shown in the figure: 


 

To use a rule for a file alone, it can be configured in the bottom of Figure 4: Restrict Scope of Coding Rules .
 
The file path can use fuzzy matching, the rules are as follows:
 
            ? matches a single character
            ** matches 0 or more folders 
            * matches 0 or more characters
 
In addition, you can also add sonar.exclusions to Maven 's pom.xml file to indicate which files (folders) do not need to be analyzed.
<properties>
    <sonar.exclusions>
        src/main/java/com/.../domain/model/**/*,
        src/main/java/com/.../exchange/**/*
    </sonar.exclusions>
</properties>
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326227614&siteId=291194637
Recommended