Sonarcloud bot on github PRs not updating after a commit is submitted
Let’s walk through whats happening. First I create a PR, and my code has 2 code smells. I see these 2 code smells on my Github PR as well as SonarCloud itself. I then go fix those code smells by pushing a new commit to the open Github PR. Now the sonarcloud bot on github still shows the 2 code smells, plus sonarcloud site also still shows the 2 code smells. If you look at the background tasks and analysis, it did run another analysis and did find zero code smells, but sonarcloud page for that PR is not being updated. This is happening pretty consistent on a few Github repos we have, and not so often on others.
Here is the screenshot of the analysis and the dashboard. The 2 code smells should have disappeared from the dashboard since the code doesn’t exists anymore.
The first screenshot shows the background tasks? Is that the only place you see these analyses? And if so, wow are you verifying that these background tasks correspond to the PR in question?
Sonar states is ran on the latest code commit, but when you look in the code for that commit, it does not match. Another way of saying it, the changes in Github do not make it into SonarCloud even though SonarCloud states they are pulling the latest commit. Code doesn’t match
The commit number on the right side of this image shows the commit that it analyzed. On github, this commit shows the code to be “const x = 5;”. If you go to the code tab on the image on the right the code will say “x=5”. The code on sonar does not match that latest commit.
So it turns out that we just deployed an automatic analysis fix that’s probably relevant here. Unfortunately the ticket is in a private Jira project, but the title is
Checkout of pull requests sometimes get an outdated (or missing) commit
Can you make a small change to trigger a new analysis and see if this is fixed?
I wasn’t able to retrigger the analysis on the same repo since we merged it already, but I did run a test for a new Pull Request and the things were working as expected. Thank you