Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enhance UseDeclaredVarsMoreThanAssignments to detect also take into account the usage of Get-Variable with an array of variables and usage of named parameter -Name#1310

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@bergmeister
Copy link
Collaborator

PR Summary

Fixes#1301 by enhancing the parsing of theGet-Variable AST to also check if an array is passed or if the-Name parameter is used as a named parameter (including cases where it is shortened to-n).
Also refactored logic into it's own static method for better readability and performance.
Since reverse engineering aCommandAst into the used parameters is quite complex, I am not going to further enhance it.

PR Checklist

Copy link
Contributor

@rjmholtrjmholt left a comment
edited
Loading

Choose a reason for hiding this comment

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

This makes me think we should really invest in some general purpose AST functionality (like parameter parsing/binding tools) (but probably don't have the time currently).

Otherwise, LGTM

@bergmeister
Copy link
CollaboratorAuthor

Yes, I agree something like a parameter binder helper would be nice but I think it would require the runtime and be no purely static just based on the AST. Maybe some of the parameter binder functionality in PowerShell could be exposed?

@bergmeisterbergmeister merged commitbba8fed intoPowerShell:masterAug 19, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@rjmholtrjmholtrjmholt approved these changes

Reviewers whose approvals may not affect merge requirements

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

PSUseDeclaredVarsMoreThanAssignments reported on "get-variable -include var1,var2"

3 participants

@bergmeister@rjmholt@JamesWTruher

[8]ページ先頭

©2009-2025 Movatter.jp