Clarification on Duplicate Lines Calculation in SonarQube

I’m currently using SonarQube to analyze my project, and I’ve noticed that the “Duplicated Lines” metric is showing 12.6% duplication, but no code smells are being reported related to it. My question is, how exactly are duplicate lines calculated in SonarQube?

If the duplication is being calculated based on specific rules, why aren’t these duplicate lines being flagged under “Code Smells”? Could there be a setting or configuration that I’m missing?

Any insights or guidance would be greatly appreciated. Thanks!

Hi,

Welcome to the community!

Duplication metrics are separate from issues. The docs give information on how they’re calculated.

 
HTH,
Ann

Hi Ann,

I have now understood duplicate lines calculation.
Is there a way to customize duplicate lines calculation. For example, can I update following condition " There should be at least 100 successive and duplicated tokens." to 150 successive duplicated token.

Thanks
Keerthana

Hi Keerthana,

There are a couple of analysis parameters available to tune duplication detection.

 
HTH,
Ann