Issue API distinguish between a new confirmed and old confirmed issue for a same project between 2 analysis

Hi,

I am using sonarQube community edition latest version 8.2
I am developing a reporting tool that tracks for a given project over time and several analysis action plans
Too bad that the action plan feature was removed from sonarqube version 4.x …

I modeled an action plan as an issue with a status = CONFIRMED. I am then interested in counting following information:

  • total new confirmed issues grouped By ruleId
  • total old (existing) confirmed issues grouped By ruleId
  • total resolved issues (fixed and removed) and which were previously in status= confirmed
  • total false positive issues groupedBy ruleId
  • total won’t fixed issues groupedBy ruleId

What i have achieved so far is to retrieve for a given projectKey, and project version,
fetch corresponding analysis date with endpoint
/api/project_analyses/search?project=[PROJECT_KEY]
then fetch all RESOLVED issues and UNRESOLVED issues with the endpoint /api/issues/search
and parameters componentKeys, resolved= true or false, severities=BLOCKER,CRITICAL,MAJOR,
statuses= CONFIRMED,REOPENED, or RESOLVED,CLOSED and resolutions", "FALSE-POSITIVE,WONTFIX,FIXED,REMOVED
and filtered on the analysis date with parameter createdBefore

I can compute total confirmed issues which were being fixed thanks to the endpoint /api/issues/changelog?issue=[ISSUE_KEY]…

But i have some trouble to compute total number of NEW confirmed issues and total number of OLD existing confirmed issues between 2 analysis…
I try to use this logic :
IF issue.status = CONFIRMED and IF issue.creationDate.before analysisDate
then Total OLD confirmed ++
ELSE IF issue.status = CONFIRMED and IF issue.creationDate == analysisDate
then Total NEW confirmed ++

Any idea on how to distinguish between a new confirmed issue and an existing confirmed issue ?

Hi,

Welcome to the community!

Your goal is not entirely clear to me, so this may be irrelevant, but I feel the need to point out that Issue searches always return the current issue state, not the state on the date in question.

You may have some luck iterating the issue changelog: /api/issues/changelog

 
HTH,
Ann