- SonarQube Version 9.9 (build 65466)
- sonar-scanner 18.104.22.16847
What are you trying to achieve
I want to filter generic issues in the issue view by the “engineID” specified in the generic issue format. The reason for that is, that I want all generic issues from one specific tool, e.g. compiler warnings.
What have you tried so far to achieve this
The rule filter is not suitable for this, because there are several rules for one “engineID”. For example different compiler warning rules.
Questions and possible solution
Is it somehow possible to automatically add a tag to the generic findings?
If yes, I could filter the generic findings with a tag filter for example tag name: “gcc-compiler-warnings”.
Right now, I am not aware of an automatic solution for adding a tag to generic issues during the upload. I would have expect a “tags” key in the generic issue format that accepts a list of strings.
There’s no ability to do this during analysis. You would need to call the Web APIs afterward.
The best way to master the API is to perform the desired action via the UI and eavesdrop to see which calls the UI made to accomplish the action.
You may also find this guide helpful.
Thank you for your reply.
Calling the API afterwards feels wrong, because there is no other way then introducing generic findings during the analysis. It is definitely a lack in the generic issue format.
Now I have to:
- Be aware which rules should be tagged during analysis
- Search for the issues that are generated by this rule (api/issues)
- Bulk update all issues with the rules (api/issues/bulk_change)
These steps have to be done additionally. Keep in mind that I already converted the data in the generic issue format by myself, so adding a key “tags” to the generic issue format is one very easy step for me.
I think the tags feature is then completely useless for the generic issues. Is there a other way to filter issues easily by the “engineId”?
I’m not aware of any other easy solutions here. So I’ll suggest the hard one: if you wrote a plugin to register rules in SonarQube (and read those reports to natively create issues), you could have tags &etc on the rules, which the issues would automatically inherit.
Probably the Checkstyle plugin would be a good model.