Backend Notes AUG 13, 2024 • 02 MIN READ

EXCLUSION FILE AND
DUPLICATION CHECK
ON SONARQUBE

Abstract technical background

Sonarqube is an open source platform developed by SonarSource for continuous inspection of code quality to perform automatic review with static analysis of code to detect bugs and code smells on programming language.

In every Spring project that we create, of course we use Sonarqube to maintain code quality. And sometimes we need to set exceptions for which files can be scanned by Sonarqube.

Setting exclusion file

We can set which files are not scanned by Sonarqube in the file pom.xml

POM.xml XML
<properties>
    <sonar.coverage.exclusions>
        **/config/*.java,
        **/config/**/*.java,
        **/constant/*.java,
        **/model/*.java,
        **/model/**/*.java,
        **/model/**/**/*.java,
        **/exception/*.java,
        **/filter/*.java,
        **/repository/*.java,
        **/repository/**/*.java,
        **/SimulatorServiceApplication.java
    </sonar.coverage.exclusions>
</properties>

Setting duplication check

We can set it like this

POM.xml XML
<properties>
    <sonar.cpd.exclusions>
        **/config/*.java,
        **/config/**/*.java,
        **/constant/*.java,
        **/model/*.java,
        **/model/**/*.java,
        **/model/**/**/*.java
    </sonar.cpd.exclusions>
</properties>

READ BEYOND THE VOID

Technical blueprint background
Backend Notes

Bash script to auto run java application

Create executable script to auto run java...

Read Entry
Abstract digital network
Backend Notes

Service GRPC with Golang

GRPC using Golang...

Read Entry
Circuit board macro
Backend Notes

Housekeeping database Mysql on Centos server

Housekeeping your database today means fewer headaches tomorrow...

Read Entry