mitchspano / sfdx-scan-pull-request

Runs sfdx-scanner on a pull request and generates in-line comments with the findings.
Apache License 2.0
73 stars 25 forks source link

Add support for parallel jobs: each job adds its annotations without deleting others added by other jobs #74

Open vt89 opened 8 months ago

vt89 commented 8 months ago

Suppose a Pull Request has an Apex Class with a single PMD violation and an LWC with a single violation.

We want to have a GitHub Action with two parallel jobs (instead of a single one): one for PMD checks (using engine: pmd) and another for the ESLintLWC violations (using engine: eslint-lwc).

I have noticed that either the PMD or the ESLintLWC result is added as annotation, but not both. I suppose it happens because both jobs execute the SFDX Scanner with all the changes files in the Pull Request and since we have specified the engine (either pmd or eslint-lwc) the last ending job deletes the result of the other jobs and only its result is shown (either for PMD or ESLintLWC).

It would be nice if each (parallel) job does not delete the result of other executed jobs. Another solution could be to invoke the SFDX Scanner passing only the proper files based on the specified engine: it means if the engine is pmd, invoke the SFDX Scanner passing only the right files (e.g. Apex Class, Visualforce Page) even if the Pull Request contains also other files.

vt89 commented 8 months ago

I just noticed that this behaviour happens when the report-mode is check-runs. If we use report-mode: comments then all the comments from all the parallel jobs are added.