Duplication line could not be seen on PR

We have a quality get on PR regarding duplication line…
One of the PR is tagged with duplication code:
image

BUT it is impossible to understand where it is, there is NO gray line on the border of the file (as we can see on main branch regarding duplication)

It seems that the duplication code is not well shown on PR, that make VERY difficult the analyse and the correction of this error.

Regards

Hey there.

That’s odd – I am able to view the duplicated code on a PR in SonarCloud

If you take any of the files where duplication is reported and try an API call like this:

https://sonarcloud.io/api/sources/lines?key=sonaranalyzer-dotnet%3Aanalyzers%2Fsrc%2FSonarAnalyzer.VisualBasic%2FRules%2FHotspots%2FDoNotHardcodeCredentials.cs&from=1&to=502

(the value for key is the same value as selected in the URL when you’re browsing the UI)

Do you see any lines marked as duplicated:"true"?

Can you also confirm what language these files are?

Yes I see some and with isNew: true:
{“line”:549,“code”:"…,“duplicated”:true,“isNew”:true}

BUT nothing on sonar for this line 549
image

Thanks.

And just to make sure we have the full picture, can you confirm this point?

The file is in C++

Thanks.

I can’t reproduce this on a C++ repo with a pull request (with duplication). Take for example this public project.

Ill reach out for some private details.

I think the difference is that you have duplication in the same file, here I think we have duplication from another file THAT IS NOT part of the PR, so I suspect that it is the issue, has the file is not part of the PR it could not show it, and duplication is not usable :frowning:

Hello @Laurent,

Sorry for not getting back earlier. I started looking into this issue today. I will ask for more information in private

I was able to see the issue. I will check if there can be a quick fix for this one. I will keep you posted

@Laurent I confirm that this is a bug and I have created an internal ticket for this. I will try to prioritize this in the coming week.

1 Like

There is a fix I have pushed for the issue. It should be available on sonarcloud.io either Monday or Tuesday

2 Likes

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