X Tutup
The Wayback Machine - https://web.archive.org/web/20200918095148/https://github.com/PowerShell/PSScriptAnalyzer/pull/1216
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

Do not use alias name as key for command info cache to fix the problem where UseCorrectCasing corrects aliases #1216

Conversation

@bergmeister
Copy link
Collaborator

bergmeister commented Apr 13, 2019

PR Summary

Fixes PowerShell/vscode-powershell#1842
Because aliases were used as the key for the cache, once those entities are created, it caused the UseCorrectCasing rule to correct aliases, somehow those cache entries could only be populated when and lead to this behaviour when being used via the vscode extension so I assume it must the some of the commands being issued at startup that cause other rules to populate this entry
Writing a test for this turned out to be hard as only when being used via the PowerShell vscode extension, alias key entries were populated in PSSA's command info cache first.
The intention is to have this PR fix the root cause and another PR to a bit of a cleanup.

PR Checklist

…m where UseCorrectCasing corrects aliases
// If alias name is given, we store the entry under that, but search with the command name
var key = new CommandLookupKey(aliasName ?? commandName, commandTypes);

var key = new CommandLookupKey(commandName, commandTypes);

This comment has been minimized.

@rjmholt

rjmholt Apr 15, 2019 Member

If aliasName is unused, maybe time to remove it from the parameters?

This comment has been minimized.

@bergmeister

bergmeister Apr 15, 2019 Author Collaborator

Ok, done, I also removed the left-over GetCommandInfoInternal function that we moved into the CommandInfoCache a few weeks ago but forgot to delete.
I plan to do another PR with more general tidy up later btw.

…l function from refactoring a few weeks ago
@bergmeister bergmeister merged commit 823144c into PowerShell:development Apr 16, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla All CLA requirements met.
Details
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