X Tutup
The Wayback Machine - https://web.archive.org/web/20200918095403/https://github.com/PowerShell/PSScriptAnalyzer/pull/1386
Skip to content
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

Fix false positive of AvoidAlias rule for implicit aliasing of Get- commands for the CommandType ExternalScript #1386

Merged
merged 2 commits into from Jan 28, 2020

Conversation

@bergmeister
Copy link
Collaborator

bergmeister commented Jan 2, 2020

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

…ommands for the CommandType ExternalScript
@bergmeister bergmeister requested review from JamesWTruher and rjmholt Jan 2, 2020
Copy link
Member

JamesWTruher left a comment

This looks great - do we need any additional validation, or is what we have sufficient?

@bergmeister
Copy link
Collaborator Author

bergmeister commented Jan 28, 2020

The manual end to end test (in vs code) is all I could as somehow this happens only when PSSA is hosted in the vs code extension where those command info cache entries got populated.

@bergmeister bergmeister merged commit ba7d01a into PowerShell:master Jan 28, 2020
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla All CLA requirements met.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.
X Tutup