SonarQube is considering relocated files as new code in PR branches

When we rename a folder, SonarQube considers the underlying files as new code. Ideally similar to GIT, it should have identified that these files are not changed , the folder inside which these files exist has been renamed instead. Do we have some configuration/property in SonarQube so that it could identify the relocated files instead of treating them as new. We are using SonarQube Enterprise Edition Version 7.9.1 (build 27448) and facing this issue with Angular based project having typescript files.

Sonar Team, could you please comment on this post ?

Hi,
SonarQube doesn’t detect relocated files in pull request. It’s a limitation we have with our integration with git. Once you merge the P/R, the file move will probably be detected when the target branch is analyzed.

1 Like