I am using Sonar enterprise version 8.7. Soon to upgrade to 8.9, and I have a question that has frustrated me for a while now,
Is it possible to somehow get analysis reports for a specific commit? I’ve been able to configure branch analysis but there seems to be a further requirement to drill further and get reports for each commit.
The reason is this, if there are two people committing, and one commit has issues while the other doesn’t have any issues; if the one with issues runs first followed by the one without issues, the report won’t show any issues when looked at.
So basically, even with branch analysis, is it possible to somehow drill further down and get reports for actual commits?
I’d suggest reframing the question. If you’re doing branch analysis and one analysis’ results is immediately clearing out the results from the previous analysis, it doesn’t sound like your New Code period is set correctly. I’d expect after 2 back-to-back analysis runs that issues stemming from both commits would be displayed unless one of the commits caused your New Code period to reset (e.g. you released a new version and versioning is the basis of your New Code definition).
I’d revisit this documentation topic and inspect your New Code settings and see if you can identify a meaningful change to make here. If not please come back with details of how you have New Code and the analysis set up for the branch.
You don’t need a separate report per commit in order to tell which commit caused an issue. Simply drill in to see the issue in the context of the code and the commit info will be in the margin of the code browser.
I confirm that nothing like instant HTML reports or “preview mode” results are available anymore. All analyses are finalized asynchronously on the SonarQube server.
If you truly need to see the dashboard frozen for an individual commit, the only option I can really think of is to enforce 1 commit per branch. Consider using pull requests for each individual change and the dashboard for the PR would be exactly what you’re asking for.
When you click on any issue metric (bugs, vulnerabilities, code smells) you’ll be taken in to the Issues tab of the project to see the issues displayed. If you click on the individual issue, you’ll then see it displayed in the context of its code. Now the commit info is over on the side.