How to ignore false-positive duplications?

6,620 views
Skip to first unread message

matej....@gmail.com

unread,
May 9, 2017, 12:40:39 PM5/9/17
to SonarQube
Hello,
when i mark duplication as false positive, it still shows in Measures/Duplications list and graph (and possibly other dashboards).
Strangely "technical debt" metric gets updated, but not "duplicated lines". Is it posible to mark duplications as false positives and
have them ignored?

thanks

sonarqube version 6.3.1

G. Ann Campbell

unread,
May 15, 2017, 12:12:18 PM5/15/17
to SonarQube, matej....@gmail.com
Hi,

It's not possible to mark a duplicated block as not being a duplicate. You're getting the expected behavior.

I'm curious, though, why you want to mark duplicate blocks as false positives. Is it just to move your metric value? And if so, why?


Ann

G. Ann Campbell

unread,
May 16, 2017, 10:58:44 AM5/16/17
to Matej Svetlik, SonarQube
Hi,

Please remember to include the group in all your replies so posterity can benefit from your wisdom. :-)

Technical debt is the sum of the remediation effort of all code smell issues, so marking an issue False Positive or Won't Fix does affect that metric, but otherwise, coverage and duplications issues are entirely segregated from metrics.


Ann





---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

On Tue, May 16, 2017 at 9:08 AM, Matej Svetlik <matej....@gmail.com> wrote:
Hi,
the real problem is that if I mark issue as false-positive (or even wont-fix) the issue is still listed in all lists.
Next time when I have a bit of time to fix something, I have to search trough list of "irrelevant" tickets. So
"real" problems can slip because of lots of noise. Maybe something like "ignore for now" would work. Or
maybe just adding a filter.

There are other small issues like when I mark something as false-positive I expect that system will ignore
said "problem" in every metric. If technical debt gets updated why other metrics stay? When I resolve problem
as "false-positive", tooltip says "Its effort won't be counted." so I expected that everything gets updated.
Is there any documentation which explains some background?

PS:
In this case we have class with huge list of allowed values. Child classes redefine this set to other values. All
classes are marked as duplicate code because sonar ignores differences in literals.Maybe there is better way,
but we cannot change this. So we decided to mark it as false-positive (but wont-fix doesn't work either).

thanks










Reply all
Reply to author
Forward
0 new messages