Changed line count not taking into account moved files


We are using Sonarcloud via sonar-scanner brew formula. It is also integrated with our Github PRs.
We have spotted that Sonar fails to properly detect total number of lines changed when there are files being moved. Check the following screenshots from Sonarcloud UI and Github interface:

Screenshot 2021-02-15 at 10.49.32

This error prevents us from merging as quality gate fails due to PR being too large. Are we missing something in Sonar’s config for it to detect properly moved files?

Thanks in advance,


Hello @dcacenabes,

Thanks for reporting this. Could you provide me with the background task ID of the scan of the impacted PR? You can do this by navigating to your project page on SonarCloud > Administration > Background tasks.

1 Like

Here you go:


It is actually a know limitation on our side (both on SonarCloud and SonarQube): SonarQube is considering relocated files as new code in PR branches - #4 by dmeneses

We currently don’t have any plans on adding support for detecting moved files for PR analysis. If you regularly encounter this case I would suggest removing this rule from your quality gate. Apologies for the inconvenience.

1 Like