Skip to content

false variable is assigned but never used recommendation #1354

Closed
@seajhawk

Description

@seajhawk

Issue Type: Bug

I'm getting "The variable 'results' is assigned but never used.", but I'm actually using the variable. (recommendation appears on line with "$results = $content ..."

      If ($_ -match "#Fields:\s*(.*)"){
        $fields  = $matches[1].split(",") | ForEach-Object{$_.trim()}
        $results = $content | Where-Object{$_ -notmatch "^#"} | ConvertFrom-Csv -Header $fields
      }
    }
    If (-not $results){
      Write-Verbose "Import-CsvFieldsHeader found no valid content in the file, string or array specified."
    }
    $results

[for my reference - line 304 in autopilot.psm1]

Extension version: 2019.9.0
VS Code version: Code 1.39.2 (6ab598523be7a800d7f3eb4d92d7ab9a66069390, 2019-10-15T15:35:18.241Z)
OS version: Windows_NT x64 10.0.17763

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions