Fix false positive of AvoidAlias rule for implicit aliasing of Get- commands for the CommandType ExternalScript by bergmeister · Pull Request #1386 · PowerShell/PSScriptAnalyzer
PR Summary
Fixes #1369
Unfortunately this issue could only be reproduced when PSSA is hosted within PSES where the root of the workspace becomes the working directory of the runspace pool, which causes Get-Command ..\PathToScript.ps1 to return a command type of ExternalScript, which then makes it into the command cache and causes the false positve.
The fix is to search only for cmdlets/functions where the implicit Get- aliasing applies.
PR Checklist
- PR has a meaningful title
- Use the present tense and imperative mood when describing your changes
- Summarized changes
- Change is not breaking
- Make sure all
.cs,.ps1and.psm1files have the correct copyright header - Make sure you've added a new test if existing tests do not effectively test the code changed and/or updated documentation
- This PR is ready to merge and is not Work in Progress.
- If the PR is work in progress, please add the prefix
WIP:to the beginning of the title and remove the prefix when the PR is ready.
- If the PR is work in progress, please add the prefix