Skip to content

PSAvoidUninitializedVariable flags automatic variables #192

Closed
@RamblingCookieMonster

Description

@RamblingCookieMonster

Hi there!

My apologies if this has already been covered.

PSAvoidUninitializedVariable seems to flag automatic PowerShell variables, such as $Matches and $PSBoundParameters.

Example code:

"hi there!" -match "hi" | Out-Null
$matches[0]

Resulting warning:

Variable 'matches' is not initialized. Non-global variables must be initialized. To fix a violation of this rule, pl
ease initialize non-global variables.

Cheers!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions