Skip to content

Commit

Permalink
Fix PSUseConsistentIndentation.PipelineIndentation.None to not remove…
Browse files Browse the repository at this point in the history
… code when the previous line ended with a pipe (PowerShell#1746)

* Fix issue 1580

* add test case
  • Loading branch information
bergmeister committed May 24, 2022
1 parent 504596d commit 4890939
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Rules/UseConsistentIndentation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ caused by tokens that require a closing RParen (which are LParen, AtParen and Do

if (pipelineIndentationStyle == PipelineIndentationStyle.None && PreviousLineEndedWithPipe(tokens, tokenIndex, token))
{
onNewLine = false;
continue;
}

Expand Down
5 changes: 5 additions & 0 deletions Tests/Rules/UseConsistentIndentation.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ bar
@{ IdempotentScriptDefinition = @'
foo |
bar
'@
},
@{ IdempotentScriptDefinition = @'
foo |
bar -Parameter1
'@
}
) {
Expand Down

0 comments on commit 4890939

Please sign in to comment.