Assignment seems to be hit or miss

Sonar Version: Sonar Version: 8.3.1.34397
SCM: Git

Functions owned entirely by a single current author who is known to the sonar db (logged in and active) still for some reason won’t assign to the code author.

Thousands of issues refuse to auto-assign forcing someone to go in and see the blame shown right in sonar and manually change “Not assigned” to the code author.

I could understand if the bug was due to a cascading failure and sonar is unsure how to resolve the final assignee, but most of these seem pretty cut/dry.

Is there any debug/log I can view to see why sonar can’t figure out who to assign it to? The standard analysis output shows no information about blame/assignment.

On a related issue, is there any way to map blame to a user? We have tons of issues that git blames to user1 but user1 recently left the company and then later was re-hired after legally changing their name to user2. Is there any way sonar can detect that anything that would have been owned by user should now be assigned to user2?

1 Like

Hi,

I had to look this up in the docs to be sure I was remembering correctly:

New issues are automatically assigned during analysis to the last committer on the issue line if the committer can be correlated to a SonarQube user.

So your unassigned issues tie back to SCM accounts that can’t be correlated with users. The way to fix this is to add the missing SCM accounts to the users in SQ. Unfortunately, you’ll have to have a global admin do this for each user (Administration->Security->Users); it seems that users can’t do it for themselves. I’ve raised that point internally.

Once you’ve added the SCM accounts, future issues should be assigned automatically. Existing issues will not be retro-assigned.

No. And… :smile:
What you can do is search for issues assigned to the old username, and do a Bulk Change to re-assign them to the new username.

 
HTH,
Ann

So your unassigned issues tie back to SCM accounts that can’t be correlated with users. The way to fix this is to add the missing SCM accounts to the users in SQ. Unfortunately, you’ll have to have a global admin do this for each user (Administration->Security->Users)

I’ve never noticed that before. It seems that I am the only user with a valid scm account setup. Isn’t this a bug?

In the UI you reference, sonar says:

Login and email are automatically considered as SCM accounts

Yet in the screenshot shown, the blame data shows aaro and the user aaro logs into sonar with aaro@internalmail.com

What you can do is search for issues assigned to the old username, and do a Bulk Change to re-assign them to the new username.

If sonar was installed after user1 left, then no issues were ever assigned to user1. All I have to go on is blame data. Is there any way I can bulk edit issues with blame data correlated to user1?

Hi,

I understand your thinking, but aaro and aaro@internalmail.com are different strings. Imagine if we mapped ann to annika or mic to michael.

Sorry, no.

 
:woman_shrugging:
Ann

So sonar knows about email addresses, but doesn’t actually parse the username portion of an email to compare it against the sonar username it just does a straight strcmp.

So if the blame data for a file is blamed to developer@gmail.com I better login to sonar with developer@gmail.com because developer won’t match.

Thanks