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
This happens because the script is only statically analyzed and wasn't run, so the function definition didn't appear in the Powershell runspace. Current code before checking for the positional parameters, checks if the command exists and in case it doesn't, finishes run without returning any Diagnostics Records.
Probably we should add the function definition to some dictionary during script parsing, but the big complication in here are nested function definition and analyse of the function's scope.
An easy solution that we can come up with pretty quickly is skipping the check for function existence. If the expression looks like a command with at least 3 parameters and does not use -Parameter pattern we can return some Diagnostic records with information, that we don't recognize the command as a built-in function, but if it is a function then it uses positional parameters which should be avoided.
Same behavior that this issue #883
Steps to reproduce
Expected behavior
The rule is triggered.
Actual behavior
This rule does not fire because it only calls the GetCommandInfo() method.
Environment data
The text was updated successfully, but these errors were encountered: