How can I get the commit date associated with an issue using SonarQube Web Service API or any plugins

441 views
Skip to first unread message

ren...@gmail.com

unread,
Dec 20, 2015, 11:43:06 PM12/20/15
to SonarQube

Is there a way to get the commit date associated with an issue using SonarQube Web Service API?

My Sonar Server details

SonarQube Version - 5.2 Sonar-Runner - 2.4 Project SCM Plugin - sonar-scm-git-plugin-1.1

I am sending weekly reports on new violations to Project Managers. I use WebService API to get all new (OPEN) issues created between two dates. But some times new issues are reported which will have very old commit date like an year before. We have started sonar analysis on our project recently. Ours is a huge project with a lot of legacy code. So we have decided to concentrate on new code.

Getting issues related to old commit is creating a lot of problems. My plan is to get all issues through Web service call, then and close all issues which have commit dates before a certain date. Is there any way to achieve this?

Teryk Bellahsene

unread,
Dec 23, 2015, 6:12:06 AM12/23/15
to SonarQube, ren...@gmail.com
Hi,

You can use http://nemo.sonarqube.org/api_documentation/api/sources/scm to return the desired information.

The only reason I can see you have new issues on old commit is because you changed your language plugin version or updated the SonarQube version. Otherwise, you shouldn't have new issues on old commits.
You're right to concentrate on new code, that's our approach too: http://www.sonarqube.org/water-leak-changes-the-game-for-technical-debt-management/

So yes, you can get the commit date, but I'm not sure you should.

HTH,

Teryk

On Monday, 21 December 2015 05:43:06 UTC+1:

renjith cs

unread,
Dec 23, 2015, 10:31:59 PM12/23/15
to SonarQube, ren...@gmail.com
Hi,
  Thanks a lot for the help. Let me try those links and I will update here so that somebody else can also be benefited.
Meanwhile, I haven't upgraded my language plugin for a while. But getting this old commit date issues is very frequent in my case. I am a little bit confused about the cause. One thing I noticed is our branch (Our feature branch) is getting merged with master once in a week. And there will be lot of changes in every merge. Usually the next analysis after the merge reports lots of valid issues + lot of issues on old commits. Any guess on this?
Reply all
Reply to author
Forward
0 new messages