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

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

Copy link
Contributor

@JamesWTruher JamesWTruher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@bergmeister
Copy link
Collaborator Author

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive: "is implicitly aliasing 'Get-..\..\Target.ps1'" on file path?
2 participants