Run SFDX Scanner Issue
marcopinder opened this issue · 5 comments
When trying to run this GitHub Action I encounter the following error:
Error: Command failed: npx sfdx scanner:run --pmdconfig ruleset.xml --target "unpackaged/main/default/classes/ClientAtRiskTriggerHelper.cls" --json
Please find portion of log file with error attached.
There is a line in the log that states:
node:internal/errors:841
Contents of my YAML file also attached.
I'm not sure if this is the issue, or how to fix it. Any help you can provide would be much appreciated, thanks.
Thanks for reporting this issue. I will try to improve the error logging on the sfdx scanner:run
command to help us find out what is going on here.
@marcopinder I have made a modification of the code to improve the error logging on a branch called improveErrorLogging
Can you use this branch and let me know what you observe?
name: Run SFDX Scanner - Report findings as comments
uses: mitchspano/sfdx-scan-pull-request@improveErrorLogging
@mitchspano Thanks for this, I have tried today against the new branch and I'm seeing errors as per the attached.
Dows your project have a ruleset.xml
file? If not, you should omit the pmdconfig
declaration:
- name: Run SFDX Scanner - Report findings as comments
uses: mitchspano/sfdx-scan-pull-request@v0.1.11
with:
pmdconfig: ruleset.xml #omit this line
severity-threshold: 4
strictly-enforced-rules: '[{ "engine": "pmd", "category": "Performance", "rule": "AvoidDebugStatements" }]'
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
This was caused by an unnecessary reference to pmdconfig: ruleset.xml
in the YML file.
I have improved the output of the scan when an error is encountered so if something goes wrong when calling the sfdx
commands, you will be able to see the string representation of the error instead of the raw buffer.
I have also updated the README to have better instructions - explicitly calling out that the inputs to the scan are all optional.