Skip to content

foreach(x in z) causes issues with variable rules #72

Closed
@TravisEz13

Description

@TravisEz13

Repro

Clone https://github.com/TravisEz13/PSScriptAnalyzerExamples.git
open the repo in powershell
Invoke-ScriptAnalyzer .\doubleforeach.ps1

Expected

No issues found by the script Analyzer

Actual

Rule Name                           Severity   File Name  Line  Message
---------                           --------   ---------  ----  -------
PSAvoidUninitializedVariable        Warning    doublefore 7     Variable 'value' is not initialized. Non-global variables
                                               ach.ps1          must be initialized. To fix a violation of this rule,
                                                                please initialize non-global variables.
PSUseCmdletCorrectly                Warning    doublefore 7     Cmdlet 'Write-Output' may be used incorrectly. Please check
                                               ach.ps1          that all mandatory parameters are supplied.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions