Duplications are not shown

Hello,
I just started with SonarQube and tried to analyze an example typescript project. Everything seems to be working except for the duplications. The project has numerous duplicated lines and blocks but SonarQube says that the project has none.

What can be the reason for that? I use the latest community version and use SonarQube as a local webserver. Is this feature perhaps not included in the community version, do I need to set up a 3rd party tool or something else?

Hi,

Duplication detection is not a commercial feature. Can we see some screenshots of your project? Maybe the homepage and the Measures tab with the Size and Duplications facets (on the left) expanded?

 
Ann

The screenshots are down below. I can even show you the example project I am using → Project. For a better understanding: I write a thesis about measuring TypeScript code quality and wanna test different tools (including Sonar) against this codebase. No framework is used as this should be sufficient for checking various bug patterns and code smells


Hi,

Thanks for the screenshots.

I probably should have asked for this at the same time, but could you share the analysis log? And maybe also a screenshot of what you expect to be detected as a duplication?

 
Ann

Hi Ann,

here is the analysis log (Hope that’s the right one) and the screenshots of duplicated code.

DuplicatedCode
LongFunction
log.txt (3.5 KB)

Hi,

Thanks for the code snippets. I suspect it’s just too small to show up. Per the docs (expand the ‘Langauge-specific details’ section)

For a block of code to be considered as duplicated:

  • There should be at least 100 successive and duplicated tokens.
  • Those tokens should be spread at least on:
  • 10 lines of code…

 
HTH,
Ann

To understand you correctly, you think that the codebasis as a whole (and not duplicated block in the screenshots) is too small for Sonar to analyze duplications right?

If you instead meant that the duplicated block in the screenshots is too small to show up, shouldn’t Sonar at least identify this as ‘Duplicated Lines’?

Hi,

This isn’t about the size of the code base. It’s about the size of the duplicated block.

No. Without a duplicated block, there are no duplicated lines. The metrics are not independent of each other.

 
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.