You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...and if you name it PSScriptAnalyzerSettings.psd1 then those settings get applied implicitly if you run Invoke-ScriptAnalyzer from the root without having to specify the -Settings parameter...
Set PowerShell's location to the folder containing PSScriptAnalyzerSettings.psd1.
Invoke Invoke-ScriptAnalyzer *.
Expected behavior
No output as an indication of no errors.
Actual behavior
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSAvoidUsingCmdletAliases Warning PssaVscode 2 '%' is an alias of
.psm1 'ForEach-Object'. Alias can
introduce possible problems and
make scripts hard to maintain.
Please consider changing alias
to its full content.
@alx9r This seems to be a problem with the wildcard *.that you provided because it does not match any file and the way how the algorithm works here is that the fallback to PSScriptAnalyzerSettings.psd1 happens only if there is at least one path/file to analyze.
Therefore just use . or *.* to actually analyse files:
Invoke-ScriptAnalyzer.-Verbose
VERBOSE: Settings not provided. Will look for settings file in the given path .
VERBOSE: Found C:\Users\cberg\Downloads\PssaVscode\PssaVscode\PSScriptAnalyzerSettings.psd1. Will use it to provide
settings for this invocation.
....
I will keep this issue open though as you found a special case where the error message is slightly misleading.
bergmeister
changed the title
PSScriptAnalyzerSettings.psd1 not Used Implicitly
PSScriptAnalyzerSettings.psd1 not Used Implicitly when used together with *. for -Path parameter
Apr 25, 2018
Thanks for looking into this @bergmeister. The reason I expected * to work is because the help for the -Path parameter includes the following statement:
To analyze files that are not in the root directory of the specified path, use a wildcard character (C:\Modules\MyModule*) or the Recurse parameter.
In #975(comment) @bergmeister wrote the following:
Steps to reproduce
PSScriptAnalyzerSettings.psd1
.Invoke-ScriptAnalyzer *
.Expected behavior
No output as an indication of no errors.
Actual behavior
Environment data
The text was updated successfully, but these errors were encountered: