I’m running a self hosted Sonarqube Community Edition (version 18.104.22.168349)
Several years ago, my organisation moved from Mercurial to Git SCM.
It’s only recently, when using Sonar, that we realized that email addresses of the commit were mostly lost in the migration from Mercurial to Git (I don’t know why, I wasn’t there when the migration was done).
On legacy Mercurial committed code, when doing a git blame, the author name is fine, but the email address is always devnull@localhost. So this breaks issue assignment, since identity matching is done on email address of the author of the commit.
On recently Git committed code, everything works fine, and issues are assigned correctly
Note: we are not using shallow clone when analysing project.
Is there a way to perform issue assignment based on the author name, when email matching fails ? (I don’t think so, but one has to ask )
If not, would it be achievable in a plugin ? I can write the plugin myself, but need some hints on the best way to do it:
- a PostProcessing task ?
- a custom IssueVisitor ?
- a custom ScmProvider ?
What I’ve done so far to fix this:
- a temporary script (ran manually) that uses Web API to detect and reassign the issues, by doing a git blame in a bash. It works, but it’s far from being optimal and will only fix the existing issues. It does not prevent new issues (new rule, or some deprecation which will cause the line to have an issue without modification on it)
- add SCM account in user management. It doesn’t fix the issue, since the same email is always found.