This is a dummy project that shows a practical example of how PSScriptAnalyzer
(PSSA) can be customized (choosing the rules that are of interest or not) AND integrated with VSCode.
The VSCode integration happens in the .vscode/settings.json file: The powershell.scriptAnalysis.settingsPath
setting that can point to a PSSA setting file (absolute or relative to the workspace root) and this way you can customize where you wil see the squigglies. The powershell.codeFormatting.preset
offers one of the built-in code styles and affects how VSCode will auto-format (Ctrl+K+F) your code. The styles are: Allman
, Stroustrup
and OTBS
, for more details about those see here.
The PSSA customization is defined in this PSSA settings file, for details please refer to the PSSA documentation here and more example files here. The settings file name was chosen to be PSScriptAnalyzerSettings.psd1
so that Invoke-ScriptAnalyzer
can pick it up implicitly when you run the command from this location. The keys in the Settings file represent all parameters from the cmdlet. One of them is CustomRulePath
that points to a simple example of a custom rule. More detail in general are available on the PSScriptAnalyzer repo.