Hi all,
I am in the process of writing up custom rules to invoke my company style guide. To begin with I have written a simple function that appears to work correctly when running Invoke-ScriptAnalyzer, returning a Diagnostic Record[].
Does anyone have a guide on implementing custom rules in VSCode? Ideally it will automatically highlight code that does not conform to both the built in script analyzer rules and the custom ones defined.
I have attempted to update the PSScriptAnalyzerSettings.psd1 (and ensured powershell.scriptAnalysis.settingsPath points to that file) with the following:
@{
# I have changed the path below for privacy
CustomRulePath="\\mydomain\blah\blah\blah\blah\blah\PowershellScriptAnalyzer"
IncludeDefaultRules=$true
RecurseCustomRulePath = $true
ExcludeRules = @(
'PSAvoidUsingWriteHost',
'PSUseShouldProcessForStateChangingFunctions',
'PSUseOutputTypeCorrectly'
)
}
Any ideas?
Thanks!
Hi all,
I am in the process of writing up custom rules to invoke my company style guide. To begin with I have written a simple function that appears to work correctly when running
Invoke-ScriptAnalyzer, returning aDiagnostic Record[].Does anyone have a guide on implementing custom rules in
VSCode? Ideally it will automatically highlight code that does not conform to both the built in script analyzer rules and the custom ones defined.I have attempted to update the
PSScriptAnalyzerSettings.psd1(and ensuredpowershell.scriptAnalysis.settingsPathpoints to that file) with the following:Any ideas?
Thanks!