Type: New Feature
Resolution: Won't Fix
Affects Version/s: 2.2
Fix Version/s: None
Component/s: Quality Profile
Number of attachments :
It should be possible to filter certain findings after a report has shown that the finding is irrelevant or that there is no other way of dealing with it. For example, there are cases where catching a RuntimeException is OK and often that is described in the code by a comment. But 99% of the code this finding must be treated as a wrong exception handling pattern.
I have seen that there are ways to filter certain findings:
But because we are working with sub-contractors and we are judging the quality of their work by running Sonar on the source-code, they deliver to us, it would be fatal to show them how they can suppress certain findings.
If those comments spreads around the developers then they mark all their code with "// NOSONAR" comments
In order to solve that issue, a reviewer role should be able to filter certain findings. Those filters must be quite powerful. Different levels of scope are necessary:
- Global Scope (that can already be achieved by disabling a rule completely)
- Class Scope (disable a rule for a class)
For example test classes should not be treated as sctrict as production code
- Method scope (disable a rule for a method)
- Line Scope (single finding)
Of course, the danger that the line number is changing is quite high
In each Scope it should be possible to defined a wildcard pattern. That is important for example when the priority of a rule should be modified for test code.
The JcReport tool implements this functionality by using a XSL Stylesheet, where you can modify the normalized XML structure: