Sonarqube displays 0.0% duplication on new code

  1. Trying to get duplications on new code to be displayed in project dashboard.

    • On PR, sonar scan runs and analyses.
    • Duplication on new lines is shown as 0.0% though I can see duplicate code blocks ranging more than 10 lines of code for a .cs file scanned.

What seems to be causing this wrong display of percentage for duplicate lines of new code ? How can I fix this ? Is this legit 0.0% duplication ?

Hi,

Welcome to the community!

What’s your version of SonarQube? I’m looking at our internal dogfooding instance and seeing the duplication percentage taken out to 2 decimals:
Selection_1111

IIRC, the front end does (used to do?) some rounding before it displays duplication percentage. For more precision, you might consult the Measures page:

Selection_1112

Notice that the rounded percentage displayed here is the same 0.0% you’re seeing on the project homepage, but the lower-level metrics tell the story.

 
HTH,
Ann

Thanks Ann. This gives me some clarity.

image

On latest run, There is no duplicate lines/blocks on new code so 0.0% is the Density.

1 Like

This topic was automatically closed after 12 days. New replies are no longer allowed.