Why is this duplicated code?

Can anyone please explain me why this is duplicated code? It does not reference another file or anything and the code here is not duplicated.

The code is not the same in this file and it does not refer to another file. I suspect that it probably found some duplicate code somewhere else but its maybe ignore, so it doesn’t show the file. But this is just a hypothesis.

Sonar Version v10.7 (96327)

Hey @floriankraemer

Duplication Detection ignores string literals. Therefore I would guess that the duplication being detected is on the same file (take out all the string literals, you’re left with basically the same constructs.

If you believe there’s no value in refactoring the code, you can ignore files from duplication detection by configuring the Analysis Scope > Scope of duplication detection

Out of curiosity, what language is this being analyzed as?

1 Like

Thanks a lot for the answer!