-
Notifications
You must be signed in to change notification settings - Fork 498
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
Unassigned variable rule does not consider += operator to be an assignment #776
Comments
Hey @kapilmb, is there a bug tracking this already? Seems like I've seen one but I can't find it. |
This is a known bug with the |
Thanks! I'll keep this bug open to track the issue for the next update, but the fix will come as a part of the next PSScriptAnalyzer update. |
Maybe you are thinking of #772? I closed it since it was by design (how Pester script works). But yesterday I saw the same problem in a normal PowerShell module when the variable was used in a script block, but assigned outside of the script block. Haven't had the time to submit an issue for that yet. |
Yeah! That's the one :) |
On the surface #772 looks similar to this case but they are different. In #772, there is no way for PSSA to know if |
I got another example of the problem @triplec110h describing. Only one of the variable |
@johlju Thanks for the example. This is a bug that we want address as soon as possible. But due to the complexity of the right solution we have not been able to devote enough cycles to solving it yet. But we will definitely try to address most if not all issues related to this rule, in the next few releases. |
@tylerl0706 The bug got fixed in the referenced PR above this comment. |
Thanks @bergmeister! 🎉 |
System Details
$PSVersionTable
:Issue Description
I am experiencing a problem with...
PSES says variable is assigned but never used. It is used just below - see screenshot
Attached Logs
Follow the instructions in the README
about capturing and sending logs.
The text was updated successfully, but these errors were encountered: