- ALM used: GitHub
- CI: Travis CI
- Languages of the repository: Java
- Error observed: As the title says, when SonarCloud analyses a pull request that changes the location of a file, it treats old code as new code and fails the quality gate.
Is there any suggested workaround to pass the quality gate or a way to inform Sonar that the two files are the same?
SonarCloud detects file moves/renames when analyzing branches but currently that doesn’t work for Pull Requests when the changes are detected from the SCM. I’m afraid there is no workaround. Once you merge the pull request, the file move will probably be detected in the branch and in that case it won’t count towards “new code” in the New Code Period.
Thank you for the quick response. I hope this feature is something the Sonar team will consider for future releases.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.