diff --git a/Rules/UseConsistentIndentation.cs b/Rules/UseConsistentIndentation.cs index efb0c2b6a..099002274 100644 --- a/Rules/UseConsistentIndentation.cs +++ b/Rules/UseConsistentIndentation.cs @@ -80,6 +80,7 @@ public override IEnumerable AnalyzeScript(Ast ast, string file case TokenKind.AtParen: case TokenKind.LParen: case TokenKind.LCurly: + case TokenKind.DollarParen: AddViolation(token, indentationLevel++, diagnosticRecords, ref onNewLine); break; diff --git a/Tests/Rules/UseConsistentIndentation.tests.ps1 b/Tests/Rules/UseConsistentIndentation.tests.ps1 index 1d6eaae02..51b411a70 100644 --- a/Tests/Rules/UseConsistentIndentation.tests.ps1 +++ b/Tests/Rules/UseConsistentIndentation.tests.ps1 @@ -97,4 +97,20 @@ $param3 $violations.Count | Should Be 4 } } + + Context "When a sub-expression is provided" { + BeforeAll { + $def = @' +function foo { + $x = $("abc") + $x +} +'@ + $violations = Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings + } + + It "Should not find a violations" { + $violations.Count | Should Be 0 + } + } }