Skip to content

Commit 4890939

Browse files
authored
Fix PSUseConsistentIndentation.PipelineIndentation.None to not remove code when the previous line ended with a pipe (#1746)
* Fix issue 1580 * add test case
1 parent 504596d commit 4890939

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Rules/UseConsistentIndentation.cs

+1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ caused by tokens that require a closing RParen (which are LParen, AtParen and Do
260260

261261
if (pipelineIndentationStyle == PipelineIndentationStyle.None && PreviousLineEndedWithPipe(tokens, tokenIndex, token))
262262
{
263+
onNewLine = false;
263264
continue;
264265
}
265266

Tests/Rules/UseConsistentIndentation.tests.ps1

+5
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,11 @@ bar
390390
@{ IdempotentScriptDefinition = @'
391391
foo |
392392
bar
393+
'@
394+
},
395+
@{ IdempotentScriptDefinition = @'
396+
foo |
397+
bar -Parameter1
393398
'@
394399
}
395400
) {

0 commit comments

Comments
 (0)