...
Tip | ||
---|---|---|
| ||
Since this code will eventually run on a Linux container in GitHub, let's make sure it runs...
|
...
Research :
GitHub Action: https://github.com/microsoft/psscriptanalyzer-action
- Doesn't seem to be active, there are no responses to issues and open PRs.
Notes from documentation:
- Need to mention how to skip rule: https://docs.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/using-scriptanalyzer?view=ps-modules#suppressing-rules
- Custom rules: https://docs.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/using-scriptanalyzer?view=ps-modules#custom-rules
SARIF Tutorial: https://github.com/microsoft/sarif-tutorials
- For future reference: Once this implementation is done, should we consider migrating other linting results into SARIF format for compatibility
Exploration
- Locally, will be executing script https://github.com/Ed-Fi-Alliance-OSS/Ed-Fi-ODS-AdminApp/blob/main/eng/send-test-results.ps1
- Run:
Install-Module -Name PSScriptAnalyzer -Force
. - Run:
Invoke-ScriptAnalyzer -ScriptDefinition '"b" = "b"; function eliminate-file () { }'
to verify that module is working. - Run:
Invoke-ScriptAnalyzer -Path .\send-test-results.ps1
from eng folder.
- Test with -Fix fixes what's possible and prints the remaining results.
- Run with -ReportSummary to get more details about results.
More information about the options: https://docs.microsoft.com/en-us/powershell/module/psscriptanalyzer/invoke-scriptanalyzer?view=ps-modules
Explore https://github.com/microsoft/ConvertToSARIF