Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Closing brace of if block is deindented if block contains a pipe #1236

Copy link
Copy link
@felixfbecker

Description

@felixfbecker
Issue body actions

Before submitting a bug report:

  • Make sure you are able to repro it on the latest released version
  • Perform a quick search for existing issues to check if this bug has already been reported

Steps to reproduce

function Foo {
    if ($c) {
        $v | f
}
}

Expected behavior

This should be the expected formatting and not a rule violation:

function Foo {
    if ($c) {
        $v | f
    }
}

Actual behavior

The above is marked as a rule violation of PSUseConsistentIndentation, and it is autocorrected to this:

function Foo {
    if ($c) {
        $v | f
}
}

This does not happen if you remove the | f.

If the block contains further nested if blocks, all following closing braces are also off by one indentation to the left.

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.1.3
PSEdition                      Core
GitCommitId                    6.1.3
OS                             Darwin 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-49...
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.18.0
Hvid

Metadata

Metadata

Assignees

No one assigned

    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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.