Reputation: 6857
I have a web app project where the quality is measured under sonarqube.
As i'm dealing with an external code within my project files
Recently i have had some issues appearing due to that exetrnal code and which i'm not focusing on its quality :
So i wanna just delete the issue to appear from my sonar dashboard (which looks like the following):
The solutions that i have had where not really usefull , as :
And of course that seems to be not usefful because , i won't affect the rule itself
the second suggestion was to use the :
@SuppressWarnings
decorator in my blocks of code where the issues appeared ; : for example use it under classes or methods or even fields
-> this method results in adding some code to my extarnal code and that won't be also good as i'm not even having the permission to do it.
I wanna just the simpliest solution to delete the issue from the sonar dashboard , just suppress it from the SonarQube interface , strangely it seems that there is no a direct way to do it :
Any better ideas ??
Upvotes: 2
Views: 1543
Reputation: 1546
If you're not interested some issues because it's not your code, then you should not have SonarQube analyze that code. According to the SonarQube documention:
We recommend that you exclude generated code, source code from libraries, etc.
You should check in particular the following settings in the same documentation page:
sonar.sources
sonar.exclusions
These settings will be taken into account the next time you run an analysis.
Upvotes: 3
Reputation: 3092
The easiest way is excluding external code from the report with narrowing the focus feature.
Just add to your sonar-project.properties
file path pattern to exclusion, for example
# Exclude all classes ending by "Bean" # Matches org/sonar.api/MyBean.java, org/sonar/util/MyOtherBean.java, org/sonar/util/MyDTO.java, etc. sonar.exclusions=**/*Bean.java,**/*DTO.java # Exclude all classes in the "src/main/java/org/sonar" directory # Matches src/main/java/org/sonar/MyClass.java, src/main/java/org/sonar/MyOtherClass.java # But does not match src/main/java/org/sonar/util/MyClassUtil.java sonar.exclusions=src/main/java/org/sonar/*
Upvotes: 3