Code Analyzer Action is a GitHub Action plugin to execute Salesforce Code Analyzer and collect results. It takes parameters mostly equivalent to the Code Analyzer tool. When requested, it can render results as a markdown summary using Code Analyzer Translator plugin. Overall, it takes care of:
- Installing dependencies such as Node LTS and JVM 11
- Installing Salesforce CLI
- Installing Code Analyzer
- Executing Code Analyzer and collecting results
- Rendering results if requested
This repository is maintained by Salesforce Code Analyzer team.
Execute Code Analyzer and render output as markdown. By default, "simple" runtype is invoked. A previous step in the workflow has collected the list of target files that were changed in the PR. You can find the full example in forcedotcom/tdx23-sfca-demo.
- name: Execute Code Analyzer
id: execute-code-analyzer
uses: forcedotcom/code-analyzer-action
with:
render-results: true
target: "${{ steps.populate-target.outputs.Target }}"
Execute Code Analyzer and download CSV output file for further action. This example also overrides the default and include "dfa" runtype. Notice that outfile-artifact-name
parameter on code-analyzer-action
matches name
parameter on download-artifact
action, and outfile
parameter on code-analyzer-action
matches path
parameter in download-artifact
action.
- name: Execute Code Analyzer
id: execute-code-analyzer
uses: forcedotcom/code-analyzer-action
with:
render-results: false
outfile-artifact-name: "SFCA-Results"
outfile: "results.csv"
runtype: dfa
projectdir: "force-app/main/default"
target: "${{ steps.populate-target.outputs.Target }}"
- uses: actions/download-artifact@v3
with:
name: "SFCA-Results"
path: "results.csv"
(required)
Glob pattern, directory, or comma separated list of files to execute Code Analyzer. See scanner:run and scanner:run:dfa for information.
(required)
Takes "true" or "false" as values. If "true", Code Analyzer Action will render results as a markdown summary using Code Analyzer Translator. Else, outfile-artifact-name
and outfile
should be provided to upload results.
Default value: "SFCA-Results"
Required only when render-results
is "false".
Artifact name to be used for uploading results file. Defaults to "SFCA-Results". Use this name to download results if needed.
Default value: "simple"
Valid values are "simple" and "dfa". Invokes scanner:run
with "simple" and scanner:run:dfa
with "dfa".
Comma-separated categories to run. See scanner:run and scanner:run:dfa for information.
Provide comma-separated values of Code Analyzer engine(s) to excecute. Defaults to Code Analyzer defaults based on runtype. See scanner:run for information.
Override ESLint default environment variables, in JSON-formatted string. See scanner:run for information.
Location of custom config to execute eslint engine. See scanner:run for information.
Default value: "sfca_results.json"
Output file to collect the results in. Format depends on the extension of the filename. See scanner:run and scanner:run:dfa for information.
Path expansion upper boundary limit. Can be used only when runtype
is "dfa". See scanner:run:dfa for information.
Location of PMD Rule Reference XML to customize PMD engine. See scanner:run for information.
Path to project repository. Necessary when invoking sfge
engine. Defaults to current directory. See scanner:run and scanner:run:dfa for information.
Disables warning violations. Can be used only when runtype
is "dfa". See scanner:run:dfa for information.
Number to threads to execute rules in Graph Engine. Can be used only when runtype
is "dfa". See scanner:run:dfa for information.
Thread timeout in milliseconds on Graph Engine. Can be used only when runtype
is "dfa". See scanner:run:dfa for information.
Default value: 3
Fail run when violation severity equals or exceeds this number. See scanner:run and scanner:run:dfa for information.
JVM args to control Graph Engine run. Can be used only when runtype
is "dfa". See scanner:run:dfa for information.
Location of tsconfig file while executing eslint-typescript engine. See scanner:run for information.
Code Analyzer Action is implemented as a composite GitHub Actions plugin written with mostly bash shell.
We welcome external contributions for features and bug fixes.
See the versioning documentation.