Replies: 1 comment 1 reply
-
The tags are currently generated from the ruleset name: Not sure, why we put the rulesetname as a tag, but that's how it was implemented back then. Reading the Sarif Spec https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141790700
That we put rulesetname into tags is actually wrong. Rule Properties would fit inside "3.50 reportingConfiguration object" and "3.51 configurationOverride object" as parameters - and that's probably not implemented yet on PMD side. That means, the sarif report doesn't contain the information, which property values have actually been used when PMD was executed. But before changing anything, we should first try to understand your use case... Why do you want to add a tag? What is it used for? Where does its value come from? Using rule properties to add tags doesn't look correct. Rule properties provide a configuration possibility for rules - tags are something else (although I actually don't know what tags are and what they potentially being used for...). |
Beta Was this translation helpful? Give feedback.
-
Is there a way to add custom tags in PMD sarif file?
In the xpath rule, I've added a property as below:
<property name="action" type="String" value="Document Only" description="A String Property."/>
Once PMD runs and a sarif file is generated, is there a way to customise the 'tags' of rules in the sarif.json:
Actual :
"rules": [ { "id": "Debuglogs", "shortDescription": { "text": "Avoid debug statements" }, "fullDescription": {}, "helpUri": "", "help": {}, "properties": { "ruleset": "Debug Statements Count", "priority": 1, "tags": [ "Debug Statements Count" ] } } ]
Expected:
"rules": [ { "id": "Debuglogs", "shortDescription": { "text": "Avoid debug statements" }, "fullDescription": {}, "helpUri": "", "help": {}, "properties": { "ruleset": "Debug Statements Count", "priority": 1, "tags": [ "Debug Statements Count", "Document Only" ] } } ]
If not tags, then any other way to customise the rule in the sarif with the custom proeprty from ruleset?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions