@@ -129,6 +129,7 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
129
129
var tokens = Helper . Instance . Tokens ;
130
130
var diagnosticRecords = new List < DiagnosticRecord > ( ) ;
131
131
var indentationLevel = 0 ;
132
+ var currentIndenationLevelIncreaseDueToPipelines = 0 ;
132
133
var onNewLine = true ;
133
134
var pipelineAsts = ast . FindAll ( testAst => testAst is PipelineAst && ( testAst as PipelineAst ) . PipelineElements . Count > 1 , true ) ;
134
135
for ( int tokenIndex = 0 ; tokenIndex < tokens . Length ; tokenIndex ++ )
@@ -160,6 +161,7 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
160
161
if ( pipelineIndentationStyle == PipelineIndentationStyle . IncreaseIndentationAfterEveryPipeline )
161
162
{
162
163
AddViolation ( token , indentationLevel ++ , diagnosticRecords , ref onNewLine ) ;
164
+ currentIndenationLevelIncreaseDueToPipelines ++ ;
163
165
break ;
164
166
}
165
167
if ( pipelineIndentationStyle == PipelineIndentationStyle . IncreaseIndentationForFirstPipeline )
@@ -168,6 +170,7 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
168
170
if ( isFirstPipeInPipeline )
169
171
{
170
172
AddViolation ( token , indentationLevel ++ , diagnosticRecords , ref onNewLine ) ;
173
+ currentIndenationLevelIncreaseDueToPipelines ++ ;
171
174
}
172
175
}
173
176
break ;
@@ -238,13 +241,11 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
238
241
continue ;
239
242
}
240
243
241
- if ( pipelineIndentationStyle == PipelineIndentationStyle . IncreaseIndentationForFirstPipeline )
244
+ if ( pipelineIndentationStyle == PipelineIndentationStyle . IncreaseIndentationForFirstPipeline ||
245
+ pipelineIndentationStyle == PipelineIndentationStyle . IncreaseIndentationAfterEveryPipeline )
242
246
{
243
- indentationLevel = ClipNegative ( indentationLevel - 1 ) ;
244
- }
245
- else if ( pipelineIndentationStyle == PipelineIndentationStyle . IncreaseIndentationAfterEveryPipeline )
246
- {
247
- indentationLevel = ClipNegative ( indentationLevel - ( matchingPipeLineAstEnd . PipelineElements . Count - 1 ) ) ;
247
+ indentationLevel = ClipNegative ( indentationLevel - currentIndenationLevelIncreaseDueToPipelines ) ;
248
+ currentIndenationLevelIncreaseDueToPipelines = 0 ;
248
249
}
249
250
}
250
251
0 commit comments