-
Notifications
You must be signed in to change notification settings - Fork 395
UseCmdletCorrectly : This rule only fires for the cmdlets / functions loaded in the default runspace #883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Even if this got implemented in the future, it would probably be limited to one scope and functions defined in the same file because PSSA analyses the files one by one. Loading all scripts into memory would be a huge memory and performance impact. Maybe a possible workaround would be to allow it to sniff the defined functions in the current runspace, which would add the cmdlets of the installed modules or require the user to import the modules on which the files to be analysed depend on before running PSSA. This would allow the following to throw a |
it would probably be limited to one scope and functions defined in the same file Maybe someone else can think of a better design idea? Unfortunately this class is private, if in a script module I write a rule needing this type of search, I have to extract it and insert it into my module or a dll. Several rules existing or request could also benefit from this class. |
@LaurentDardenne Thanks for the pointer to |
You seem to know the codebase quite well in general but others might take more time to get resolved. at the moment Invoke-ScriptAnalyzer -ScriptDefinition 'Invoke-ScriptAnalyzer' does not trigger a warning either. it if you could make a PR for some of your raised issues |
In addition : |
there's an additional issue with UseCmdletCorrectly, it will only fire if the number of mandatory parameters is equal or greater than the number of parameter sets, so while it should report an issue with |
This rule does not fire because it only calls the GetCommandInfo() method.
The test file does not contain this use case.
The text was updated successfully, but these errors were encountered: