@@ -427,29 +427,32 @@ protected override void StopProcessing()
427
427
428
428
private void ProcessInput ( )
429
429
{
430
- IEnumerable < DiagnosticRecord > diagnosticsList = Enumerable . Empty < DiagnosticRecord > ( ) ;
431
- if ( IsFileParameterSet ( ) )
430
+ WriteToOutput ( RunAnalysis ( ) ) ;
431
+ }
432
+
433
+ private IEnumerable < DiagnosticRecord > RunAnalysis ( )
434
+ {
435
+ if ( ! IsFileParameterSet ( ) )
432
436
{
433
- foreach ( var p in processedPaths )
434
- {
435
- if ( fix )
436
- {
437
- ShouldProcess ( p , $ "Analyzing and fixing path with Recurse={ this . recurse } ") ;
438
- diagnosticsList = ScriptAnalyzer . Instance . AnalyzeAndFixPath ( p , this . ShouldProcess , this . recurse ) ;
439
- }
440
- else
441
- {
442
- ShouldProcess ( p , $ "Analyzing path with Recurse={ this . recurse } ") ;
443
- diagnosticsList = ScriptAnalyzer . Instance . AnalyzePath ( p , this . ShouldProcess , this . recurse ) ;
444
- }
445
- WriteToOutput ( diagnosticsList ) ;
446
- }
437
+ return ScriptAnalyzer . Instance . AnalyzeScriptDefinition ( scriptDefinition , out _ , out _ ) ;
447
438
}
448
- else
439
+
440
+ var diagnostics = new List < DiagnosticRecord > ( ) ;
441
+ foreach ( string path in this . processedPaths )
449
442
{
450
- diagnosticsList = ScriptAnalyzer . Instance . AnalyzeScriptDefinition ( scriptDefinition , out _ , out _ ) ;
451
- WriteToOutput ( diagnosticsList ) ;
443
+ if ( fix )
444
+ {
445
+ ShouldProcess ( path , $ "Analyzing and fixing path with Recurse={ this . recurse } ") ;
446
+ diagnostics . AddRange ( ScriptAnalyzer . Instance . AnalyzeAndFixPath ( path , this . ShouldProcess , this . recurse ) ) ;
447
+ }
448
+ else
449
+ {
450
+ ShouldProcess ( path , $ "Analyzing path with Recurse={ this . recurse } ") ;
451
+ diagnostics . AddRange ( ScriptAnalyzer . Instance . AnalyzePath ( path , this . ShouldProcess , this . recurse ) ) ;
452
+ }
452
453
}
454
+
455
+ return diagnostics ;
453
456
}
454
457
455
458
private void WriteToOutput ( IEnumerable < DiagnosticRecord > diagnosticRecords )
0 commit comments