I am using org.sonar.api.batch.sensor.issue.NewIssue class to create/raise a new Issue in my custom plugin.
I need to add tags to the Issues while creating the new Issue. And I know that it’s possible since I can do it via WebAPI and UI.
I am using Sonarqube 7.7 Community and sonar-plugin-api 7.7
If you have questions about upgrading, feel free to open a new thread for that here.
Regarding your question, on creation issues inherit their tags from the underlying rules. Adding additional tags is an edit, whether through the API or the UI.
I’m not familiar with the details of that API. I was speaking of the Web API. From the server side it’s quit possible you could. You should explore what’s available in the API.
We are using SonarQube 9.9. Being able to set tags via NewIssue from within our plugin (Sensor implementation) would also be helpful for us.
As far as I understand it’s only possible via the UI or the REST API (POST api/issues/set_tags) at the moment. The REST API does not appear to be feasible because the issue does not exist until the analysis has been run in SonarQube. Or am I missing something?
Ok, thanks for confirming. Could this be placed as a feature request somehow? Let me know if you need a customer / server ID to give it more legitimacy.
And while we’re at it, these issue tags would also be great to have access to in org.sonar.api.ce.measure.Issue while calculating measures.
Thank you for bringing this to our attention. We are not actively working on this as of now, but I recorded it in our systems for further consideration.