◐ Shell
clean mode source ↗

Fix edge case of PSUseConsistentIndentation for non-default value (IncreaseIndentationForFirstPipeline/IncreaseIndentationAfterEveryPipeline) by bergmeister · Pull Request #1423 · PowerShell/PSScriptAnalyzer

JamesWTruher

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks fine

DiagnosticRecord = $violations[0]
CorrectionsCount = 1
ViolationText = "baz"
CorrectionText = (New-Object -TypeName String -ArgumentList $indentationUnit, ($indentationSize * 1)) + 'baz'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could also be written without using New-Object:

CorrectionText = ($indentationUnit * $indentationSize) + 'baz'

it's sort of a toss up as to which one is more readable

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, thanks, I applied it, I could even remove the parenthesis because multiplication takes precedence over addition