Closed mitchspano closed 1 year ago
I've began working on this in the feature/registerCustomRules
branch.
We can test it out like this:
- name: Run SFDX Scanner - Report findings as comments
uses: mitchspano/sfdx-scan-pull-request@feature/registerCustomRules
with:
report-mode: comments
pmdconfig: "pmd/category/xml/custom.xml"
custom-pmd-rules: '[{ "rulesetPath": "pmd/category/xml/custom.xml", "language": "xml"}]'
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
I was able to register custom Apex rules and have them executed with the scan:
I will make some additional minor changes over the weekend, but looking forward to publishing this improvement to the action!
When using a PMD ruleset file which contains a custom rule, sfdx scanner requires the registration of the rules before they can be picked up by the scan. For each file, we need to call
sfdx scanner:rule:add
with the appropriate--language
and--path
arguments.The sfdx-scan-pull-request action should enable users to define the languages and paths that they want to register before scan execution.
For additional context, see this comment.