How to fetch issues of a given analysis job

Hello,

I’m using Sonarqube 10.3 and trying to use a custom PostProjectAnalysisTask (java) to fetch all issues of a particular analysis job.

I can get Analysis UUID and Analysis Date from the context. But it seems they are not very useful to filter issues from the /issues/search API.

As a workaround I decided to fallback to createdAt = Analysis Date - 5 minutes, but it’s not ideal.

Any other suggestions?

Thanks,
Bhathiya

Hi Bhathiya,

Issues aren’t tied to analyses. That’s why you’re not able to filter by analysis ID. Why? Well… imagine I introduced an issue on Jan 1. It showed up in that analysis and was added to the SonarQube DB.

Then on Jan 2 either:

  • the issue showed up again - it remains Open
  • the issue didn’t show up again - it is Closed

So issues either show up in every analysis, or they get closed and eventually purged from the DB.

And housekeeping means that there’s really no point in trying to tie them to that initial analysis either, because eventually that analysis record will probably be purged from the DB too.

What you’re doing with the date is the best you can do.

 
HTH,
Ann

1 Like

Hi Ann,

Great explanation. Now it makes sense. Thank you.

Bhathiya

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.