Different Sonarcloud results on local machine and CircleCI server

Found related thread: Code is empty on Pull Request reviews
Which eventually points to a bug in CircleCI: https://discuss.circleci.com/t/git-checkout-of-a-branch-destroys-local-reference-to-master/23781

tl;dr; - Circle destroys local reference to the master and therefore master and feature branches point to the same commit - Sonarqube thinks that there are no code changes.
The solution is to execute git branch -f master origin/master before analysis

2 Likes