Skip to content

powershell ForEach Reduce Syntax not interpreted as usage #96

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

Closed
modellking opened this issue Jan 10, 2023 · 1 comment
Closed

powershell ForEach Reduce Syntax not interpreted as usage #96

modellking opened this issue Jan 10, 2023 · 1 comment

Comments

@modellking
Copy link

What steps will reproduce the issue?

(1..3) | ForEach-Object {
    $Hashes = ""
} {
    $Hashes += "Some-String "
} {
    $Hashes
}

What is the expected result?

No Issue being detected. $Hashes is read and modified in the loop and is being passed on due to the third bracket. (Yes this is apparently not documented)

What happens instead?

line 2 $Hashes gets marked with "The variable Hashes is assigned but never used."

@ForNeVeR
Copy link
Collaborator

ForNeVeR commented Oct 1, 2023

This is not a plugin issue but an issue of PSScriptAnalyzer, the analyzer issue we use.

I have reported it upstream: PowerShell/PSScriptAnalyzer#1942.

@ForNeVeR ForNeVeR closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants