Fix logic errors in AvoidAlias rule#1251
Merged
JamesWTruher merged 2 commits intoPowerShell:developmentfrom Jun 5, 2019
Merged
Fix logic errors in AvoidAlias rule#1251JamesWTruher merged 2 commits intoPowerShell:developmentfrom
JamesWTruher merged 2 commits intoPowerShell:developmentfrom
Conversation
The first fix is that after the yield return, we should move on to the next command The second fix is that if we find _any_ command, we should not move on to the 'Get-<command>' variant These changes mean that we do not run a pipeline (twice!) to find something that was a cache miss. In the pathological case of a script mmade up of only unique aliases, we would run 2 pipelines for each found alias.
bergmeister
reviewed
Jun 5, 2019
bergmeister
approved these changes
Jun 5, 2019
Collaborator
bergmeister
left a comment
There was a problem hiding this comment.
One minor suggestion but looks great otherwise. I will modify PR #1178 to not parallelize the AvoidAlias rule any more since with this improvement the rule is no longer the weakest link in the chain
Co-Authored-By: Christoph Bergmeister [MVP] <c.bergmeister@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
The first fix is that after the yield return, we should move on to the next command
The second fix is that if we find any command, we should not move on to the 'Get-' variant.
These changes mean that we do not run a pipeline (twice!) to find something that was a cache miss. Previously in the pathological case of a script made up of only unique aliases, we would run 2 pipelines for each found alias. This fix avoids both of those pipeline invocations.
PR Checklist
.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.