When we see the issues raised in SonarCloud, they appear as ânot assignedâ.
As per the documentation, the issue is automatically assigned to the last committer. We have checked in SonarCloud and the user committing the code does appear under âMembersâ of the project.
Some log details:
INFO: Found 122 MSBuild C# projects: 55 MAIN projects. 8 TEST projects. 59 with no MAIN nor TEST files.
INFO: Sensor C# [csharp] (done) | time=16703ms
INFO: Sensor Analysis Warnings import [csharp]
INFO: Sensor Analysis Warnings import [csharp] (done) | time=5ms
INFO: Sensor C# File Caching Sensor [csharp]
INFO: Sensor C# File Caching Sensor [csharp] (done) | time=581ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=693ms
INFO: SCM Publisher No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
INFO: CPD Executor 630 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 1901 files
INFO: CPD Executor CPD calculation finished (done) | time=857ms
INFO: Analysis report generated in 5110ms, dir size=50 MB
INFO: Analysis report compressed in 7589ms, zip size=9 MB
INFO: Analysis report uploaded in 1812ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=XXXX
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=XXXXX
INFO: Sensor cache published successfully
INFO: Analysis total time: 3:23.909 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 3:39.031s
INFO: Final Memory: 63M/210M
INFO: ------------------------------------------------------------------------
The SonarScanner CLI has finished
20:17:40.832 Post-processing succeeded.
Finishing: SonarCloudAnalyze
Donât do this either. By changing the project version string with every build, youâre
ruining your ability to use the âprevious versionâ New Code definition
marking every single build as a new release version and therefore special, and to be retained indefinitely. You donât care about the (admittedly minor) DB bloat this causes because thatâs on our end, but you probably care that it makes rendering your Activity tab slower over time.
Looking at the userâs account, does the ID in the commit match the login the user is using for SonarCloud and/or an SCM Account listed for the user?
Thanks Ann for your feedback. I will pick up the first two points raised. For the last one around ID, we use SSO integration for both Azure DevOps and SonarCloud. Assuming that we are getting same email id to login to both applications, the ID should be same.
Is there anything specific I can look at to compare or check in the logs somewhere?
I am not sure how to find it. If I try to assign an âNot assignedâ issue to myself I can see the user listed like this:
On the âMembersâ screen, I can see my username as below:
I am not sure why user is not show with email id but that might just be the default behavior.
As I mentioned earlier, we just use SSO login so I assume that if both systems are not configured correctly to work, I should not be able to sign in at first place. Hope that makes sense.
Can you check an issue you know you created, and see if the blame data you get when you click next to it in the left margin shows the same user name as your screenshot above, please?
Just to confirm, are you talking about the SonarCloud application? Not too sure what you mean by âclick next to it in the left marginâ. Any screenshot or guidance will help me understand this better.
Thanks. I use gitExtensions and I can see the same user name at both places (i.e. gitExtensions and SonarCloud) for the last change I built for and the issue showing up in the SonarCloud. The issue still remains unassigned. What else can I try?
Please go into SonarCloud, select an issue, and click in the margin to its left. Then compare the Author you see there with the user account in SonarCloud.
Thanks for the clarification. Unfortunately I donât see any Author or commit hash details as you shared with your sample screenshot.
I also checked for another issue but similar type of problem persists. Is this information failing to get synced to SonarCloud? How can we check further details?
Okay, this is the problem; it looks like analysis doesnât have full access to the blame data.
Aaand⌠now I see what I missed in your initial post:
BTW, donât use that property; it doesnât work. Iâve tried to get that message removed - so far unsuccessfully.
So⌠letâs talk about how your source code gets into the directory where analysis takes place. You should be checking out into the workspace and then analyzing there, side-by-side with the SCM metadata. That makes the SCM blame data available to analysis for things like proper issue dating and assignment.
Thanks Ann for your help so far and prompt answers. I am not sure âanalysis doesnât have full access to the blame dataâ means?
As you explained in detail how SonarCloud analysis works, I am not too sure if we can do anything about controlling the behavior of checkout of code since its all happening on Azure hosted build agents. Also if I may share the below logging from one of our projects pipeline for scanning and analysis, you can see that it looks working fine (other than the SCM warning message):
> INFO: Sensor Zero Coverage Sensor
>
> INFO: Sensor Zero Coverage Sensor (done) | time=688ms
>
> INFO: SCM Publisher No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
>
> INFO: CPD Executor 630 files had no CPD blocks
>
> INFO: CPD Executor Calculating CPD for 1909 files
>
> INFO: CPD Executor CPD calculation finished (done) | time=1109ms
>
> INFO: Analysis report generated in 4086ms, dir size=50 MB
>
> INFO: Analysis report compressed in 7476ms, zip size=9 MB
>
> INFO: Analysis report uploaded in 1954ms
>
> INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=XXXX-Solutions_XXXXX
>
> INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
>
> INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=AY8wq06LzAUBdJL0Si_m
>
> INFO: Sensor cache published successfully
>
> INFO: Analysis total time: 3:40.478 s
>
> INFO: ------------------------------------------------------------------------
>
> INFO: EXECUTION SUCCESS
>
> INFO: ------------------------------------------------------------------------
>
> INFO: Total time: 4:08.435s
>
> INFO: Final Memory: 255M/854M
>
> INFO: ------------------------------------------------------------------------
>
> The SonarScanner CLI has finished
>
> 20:21:32.225 Post-processing succeeded.
Yes thatâs correct. The build agent checks out code on the MS hosted VMs (much beyond our control as its a SaaS). That being said, we have done the setup following instructions from SonarCloud documentation..
The other documentation does talk about SCM integration and possible issues around issues not being assigned automatically, but doesnât say anything specifically about Azure DevOps
When I say we have no control, I mean we canât connect to the agent to see whatâs being checked out in workspaces.
Also, if you are familiar with Azure DevOps YML based pipelines, you can see how little we actually control. Meaning we can only configure the âTasksâ in the YML pipeline. Something like below we have done for one of our pipeline:
Thanks for your help. Actually your last message put me in right direction since I was able to fix the problem by adding fetchDepth: 0 property to the .yml pipeline.
It appeared that the issue was caused by missing blame data information (as you earlier mentioned) and I was able to pull that data by setting above property.
There was another problem caused by wrong location for the base directory for Sonar analysis which once corrected, showed issues correctly assigned in SonarCloud.
Thanks for all your help and I learnt a lot during this troubleshooting.