Duplication indicator not visible

  • ALM used: GitHub
  • Languages of the repository: Kotlin, HTML

One of our PR is showing duplication (5.5%, 19 lines, 2 blocks), but we can’t seem to find the duplication indicators when we open up the referenced Kotlin file on SonarCloud. We were able to see the indicators in the past (on other PRs), so I am not sure whether this problem is just for this particular PR or something is broken on SonarCloud recently.

Any idea how we can figure out where the issue is?


Welcome to the community!

It sounds like you’ve already narrowed it to a file, but just to be sure, I’m going to start from the PR overview:

  • Click on the duplications percentage
  • From the list of files with duplications, click on the file
  • New lines - lines changed in the PR - are indicated with a yellow highlight. Look in the margin of those lines for a grey bar that indicates a duplicated block:
  • Click the bar to get details on the duplication:


Thanks, the detailed instructions does help and I think that was what we used to see in the past.

Currently, the file viewer seems to have an updated look. The new lines now have a light blue background and no grey bars on the left margin can be found throughout the whole file.

Is it possible that the latest visual updates on SonarCloud might have broken this?


I overlooked that you’re on SonarCloud and sent you screenshots from SonarQube. :woman_facepalming:

Does this sound right?


The linked post seems similar to our current issue. Not sure why I didn’t hit it when I search before I posted ours. I set myself as a watcher there now.

When I try to call the mentioned API (https://sonarcloud.io/api/sources/lines?key=) for our file, none of the lines in the result have “duplicated”:true set for them. I then consulted the API documentation (SonarCloud) and found that there’s another API that looks promising (https://sonarcloud.io/api/duplications/show?key=&pullRequest=). Sure enough, it does return a result that indicates where we have duplicated code in our PR. Thanks!

Glad to learn that looks like the issue is being worked on by SonarSource. It’s been about 3 weeks since the last update on the linked post though. Hoping to hear some good news soon!

1 Like

This looks like a different issue than the other one mentioned in the comment. In the other issue, the API was returning the duplication info correctly and the UI somehow doesn’t show it. This should be treated as a new issue. I am assigning this one to the team.

Hi @jjdstr,
I’ll reach ou to you by DM to get more information to help me investigate your issue.