Web API Query for Issues with No Tags

web_api

(Bill Smith) #1

I’m using SonarQube version 6.7.3 enterprise and have been playing with the web api. Using the api/issues/search call, is there a way to query all issues that don’t have a specific tag or an empty tag set? Originally, I tried to just do an “all” query and walk through them 1 by 1 checking for the tag, but our project is VERY large and we have in excess of 30k issues (legacy project newly scanned) and I have run into the problem where I can’t query with the pages past 20k items.


(G Ann Campbell) #2

Hi,

Uhm… That’s no a use case we’ve ever needed to cover. I don’t think you’re going to find an easy way to do it. To avoid the hard limit on the number of issues (I’da sworn it was 10k) you should try segmenting your set. I’d start with type (Bug, Vulnerability, Code Smell) and if those buckets are still to large then by creation date or perhaps by directory.

BTW, what do you need them for?

 
Ann


(Bill Smith) #3

Thx. That is kind of what I figured, but I thought it was worth asking. Our use case is that we have to identify certain releases (corporate audit stuff, don’t get me started) that don’t quite mesh with the leak period. Using tags is going to be a way that I can identity specific releases across multiple scans and uploads.

Another thought, is there a way to assign a set of tags for new issues when a scan is being performed through the gradle sonarqube plugin or with sonar-scanner?

Regards,
Bill


(G Ann Campbell) #4

Hi Bill

There’s no way to do this automatically, scanner-side. Instead, you’d pull up the new issues after each analysis (using a Creation Date filter in the Issues UI) and bulk change. This would obviously be tedious to to manually, but you might be able to automate it using web services. Look at the createdAt parameter in api/issues/search.

 
Ann