Skip to content

Question about 'PSUseDeclaredVarsMoreThanAssignment' rule #636

@LaurentDardenne

Description

@LaurentDardenne

This code triggers a violation :

$isduplicate=$false
Get-ChildItem c:\|
  Foreach-Object {
   $isDuplicate=$true
 }

This one too :

$isduplicate=$false
Get-ChildItem c:\|
  Foreach-Object {
   $isDuplicate=$true
 }
$isDuplicate
#true

But not this one :

$isduplicate=$false
Get-ChildItem c:\|
  Foreach-Object {
 }
$isDuplicate

It is the first violation correct ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions