Custom PMD rules changed tags mostly do not become visible in Sonar reports

We have our custom rules in a plugin, for Java, built on the PMD-plugin. In a new release, we have changed the tags of the rules, replaced and added tags. Now we have trouble finding the new tags in Sonar reports. They are fully new on the rules level, however, on project report level, only some rules do actually show the new tags.

New introduced violations seem to show the new situation, yet, violations which were in an earlier report already, don’t seem to show the new situation. This seems to be some kind of caching on the project report level.

Is this a known SQ ‘feature’? How can we solve this?

This is a finding in SQ 9.9.6 as well as 10.6 (Data Center Edition).

Hey there.

Rule tags are associated with an issue when the issue is created, but don’t get updated when the rule metadata itself changes.

While tedious, if you need to you can bulk change issues to change the tags.

Hi Colin,

Thanks for your reply.

When a new scan is executed, are new issues created when they already were reported before? The tags seem not to update with a new scan.

Bulk change would mean we have to manually change tags for each rule? For each project? It concerns 120 rules and 5000+ projects, so I guess that is not doable.

You at least benefit from the global Issues tab of your SonarQube instance where you can perform the changes across all projects.

No, existing issues are not recreated on each scan.

Ah right, that can be with a max of 500 issues in a bulk I see, seems not doable with 1M+ issues.
Is there a way to re-create issues?
Or the SQ API to get the tags changes in the reports?

Delete the projects and reanalyze them.

I’m not sure what you mean here, but you can use the POST api/issues/bulk_change API for help editing issue tags in bulk / in an automated fashion (500 at a time).

Okay, thanks! We will try that api way.

1 Like