X Tutup
The Wayback Machine - https://web.archive.org/web/20200918094442/https://github.com/PowerShell/PSScriptAnalyzer/pull/836
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 PSUseDeclaredVarsMoreThanAssignments when variable is assigned more than once to still give a warning #836

Conversation

@bergmeister
Copy link
Collaborator

bergmeister commented Dec 3, 2017

To resolve Issue #833
Consider the case $a=1;$a=2. Then the inAssignment will be false for the 2nd ast because varsInAssignment already contains unly assignments to unique variables. Therefore no warning was produced. This PR makes it output a warning correctly by trying to cast it to an AssignmentStatementAst an then checks the text to see if it is actually the same variable.

bergmeister added 2 commits Dec 3, 2017
…re than once to still give a warning.

Issue 833: #833
…ags a variable that is assigned twice but still never used.
@JamesWTruher JamesWTruher merged commit 8fdb7ae into PowerShell:development Jan 20, 2018
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.

None yet

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