Skip to content

Powershell Code format (PSScriptAnalyzer) flags variable as unused #889

Closed
@kapilmb

Description

@kapilmb

From @cryptonym64 on June 15, 2017 19:15

  • VSCode Version: Code 1.13.1 (379d2efb5539b09112c793d3d9a413017d736f89, 2017-06-14T18:21:47.485Z)
  • OS Version: Windows_NT ia32 10.0.14393
  • Extensions:
Extension Author Version
csharp ms-vscode 1.10.0
PowerShell ms-vscode 1.3.2
theme-stayfresh piotrekfracek 1.1.2
theme-cobalt0 sharksym 0.0.5

Steps to Reproduce:

  1. code this:
    $a = 0
    $b = @(1,2)
    $b | ForEach-Object {
    $a += 1
    }
    Write-Host $a

  2. Ctrl-Alt-F to format.

  3. Notice that it warns:
    file: 'untitled:Untitled-1' severity: 'Warning' message: 'The variable 'a' is assigned but never used. (PSUseDeclaredVarsMoreThanAssignments)' at: '4,5' source: 'PSScriptAnalyzer'

Copied from original issue: microsoft/vscode#28835

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions