-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Sarif report for multiple results
Each PMD rule violation should be reported in a separate result. This adds a fix to modify the sarif report afterwards before processing it further. Fixes #53
- Loading branch information
Showing
6 changed files
with
258 additions
and
7 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", | ||
"version": "2.1.0", | ||
"runs": [ | ||
{ | ||
"tool": { | ||
"driver": { | ||
"name": "PMD", | ||
"version": "6.40.0", | ||
"informationUri": "https://pmd.github.io/pmd/", | ||
"rules": [ | ||
{ | ||
"id": "UnusedLocalVariable", | ||
"shortDescription": { | ||
"text": "Variable 'x' defined but not used" | ||
}, | ||
"fullDescription": { | ||
"text": "\n Detects when a local variable is declared and/or assigned but not used.\n Second line.\n Third line with additional indentation.\n Fourth line with less indentation.\n " | ||
}, | ||
"helpUri": "https://pmd.github.io/pmd-6.40.0/pmd_rules_apex_bestpractices.html#unusedlocalvariable", | ||
"help": { | ||
"text": "\nDetects when a local variable is declared and/or assigned but not used.\n " | ||
}, | ||
"properties": { | ||
"ruleset": "Best Practices", | ||
"priority": 5, | ||
"tags": [ | ||
"Best Practices" | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"results": [ | ||
{ | ||
"ruleId": "UnusedLocalVariable", | ||
"ruleIndex": 0, | ||
"message": { | ||
"text": "Variable 'x' defined but not used" | ||
}, | ||
"locations": [ | ||
{ | ||
"physicalLocation": { | ||
"artifactLocation": { | ||
"uri": "/home/andreas/PMD/source/pmd-github-action-test/src/classes/UnusedLocalVariableSample.cls" | ||
}, | ||
"region": { | ||
"startLine": 3, | ||
"startColumn": 16, | ||
"endLine": 3, | ||
"endColumn": 16 | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"ruleId": "UnusedLocalVariable", | ||
"ruleIndex": 0, | ||
"message": { | ||
"text": "Variable 'x' defined but not used" | ||
}, | ||
"locations": [ | ||
{ | ||
"physicalLocation": { | ||
"artifactLocation": { | ||
"uri": "/home/andreas/PMD/source/pmd-github-action-test/src/classes/UnusedLocalVariableSample.cls" | ||
}, | ||
"region": { | ||
"startLine": 4, | ||
"startColumn": 16, | ||
"endLine": 4, | ||
"endColumn": 16 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"invocations": [ | ||
{ | ||
"executionSuccessful": true, | ||
"toolConfigurationNotifications": [], | ||
"toolExecutionNotifications": [] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", | ||
"version": "2.1.0", | ||
"runs": [ | ||
{ | ||
"tool": { | ||
"driver": { | ||
"name": "PMD", | ||
"version": "6.40.0", | ||
"informationUri": "https://pmd.github.io/pmd/", | ||
"rules": [ | ||
{ | ||
"id": "UnusedLocalVariable", | ||
"shortDescription": { | ||
"text": "Variable 'x' defined but not used" | ||
}, | ||
"fullDescription": { | ||
"text": "\n Detects when a local variable is declared and/or assigned but not used.\n Second line.\n Third line with additional indentation.\n Fourth line with less indentation.\n " | ||
}, | ||
"helpUri": "https://pmd.github.io/pmd-6.40.0/pmd_rules_apex_bestpractices.html#unusedlocalvariable", | ||
"help": { | ||
"text": "\nDetects when a local variable is declared and/or assigned but not used.\n " | ||
}, | ||
"properties": { | ||
"ruleset": "Best Practices", | ||
"priority": 5, | ||
"tags": [ | ||
"Best Practices" | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"results": [ | ||
{ | ||
"ruleId": "UnusedLocalVariable", | ||
"ruleIndex": 0, | ||
"message": { | ||
"text": "Variable 'x' defined but not used" | ||
}, | ||
"locations": [ | ||
{ | ||
"physicalLocation": { | ||
"artifactLocation": { | ||
"uri": "/home/andreas/PMD/source/pmd-github-action-test/src/classes/UnusedLocalVariableSample.cls" | ||
}, | ||
"region": { | ||
"startLine": 3, | ||
"startColumn": 16, | ||
"endLine": 3, | ||
"endColumn": 16 | ||
} | ||
} | ||
}, | ||
{ | ||
"physicalLocation": { | ||
"artifactLocation": { | ||
"uri": "/home/andreas/PMD/source/pmd-github-action-test/src/classes/UnusedLocalVariableSample.cls" | ||
}, | ||
"region": { | ||
"startLine": 4, | ||
"startColumn": 16, | ||
"endLine": 4, | ||
"endColumn": 16 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"invocations": [ | ||
{ | ||
"executionSuccessful": true, | ||
"toolConfigurationNotifications": [], | ||
"toolExecutionNotifications": [] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters