@@ -416,36 +416,35 @@ protected override void EndProcessing()
416
416
ScriptAnalyzer . Instance . CleanUp ( ) ;
417
417
base . EndProcessing ( ) ;
418
418
419
- var infoCount = diagnosticCounts [ DiagnosticSeverity . Information ] ;
420
- var warningCount = diagnosticCounts [ DiagnosticSeverity . Warning ] ;
421
- var errorCount = diagnosticCounts [ DiagnosticSeverity . Error ] ;
422
- var parseErrorCount = diagnosticCounts [ DiagnosticSeverity . ParseError ] ;
419
+ var diagnosticCount = diagnosticCounts . Values . Sum ( ) ;
423
420
424
421
if ( ReportSummary . IsPresent )
425
422
{
426
- var numberOfRuleViolations = infoCount + warningCount + errorCount ;
427
- if ( numberOfRuleViolations == 0 )
423
+ if ( diagnosticCount == 0 )
428
424
{
429
425
Host . UI . WriteLine ( "0 rule violations found." ) ;
430
426
}
431
427
else
432
428
{
433
- var pluralS = numberOfRuleViolations > 1 ? "s" : string . Empty ;
434
- var message = $ "{ numberOfRuleViolations } rule violation{ pluralS } found. Severity distribution: { DiagnosticSeverity . Error } = { errorCount } , { DiagnosticSeverity . Warning } = { warningCount } , { DiagnosticSeverity . Information } = { infoCount } ";
435
- if ( warningCount + errorCount == 0 )
436
- {
437
- ConsoleHostHelper . DisplayMessageUsingSystemProperties ( Host , "WarningForegroundColor" , "WarningBackgroundColor" , message ) ;
438
- }
439
- else
440
- {
441
- ConsoleHostHelper . DisplayMessageUsingSystemProperties ( Host , "ErrorForegroundColor" , "ErrorBackgroundColor" , message ) ;
442
- }
429
+ var infoCount = diagnosticCounts [ DiagnosticSeverity . Information ] ;
430
+ var warningCount = diagnosticCounts [ DiagnosticSeverity . Warning ] ;
431
+ var errorCount = diagnosticCounts [ DiagnosticSeverity . Error ] + diagnosticCounts [ DiagnosticSeverity . ParseError ] ;
432
+ var severeDiagnosticCount = diagnosticCount - infoCount ;
433
+
434
+ var colorPropertyPrefix = severeDiagnosticCount == 0 ? "Warning" : "Error" ;
435
+ var pluralS = diagnosticCount > 1 ? "s" : string . Empty ;
436
+ ConsoleHostHelper . DisplayMessageUsingSystemProperties (
437
+ Host , colorPropertyPrefix + "ForegroundColor" , colorPropertyPrefix + "BackgroundColor" ,
438
+ $ "{ diagnosticCount } rule violation{ pluralS } found. Severity distribution: " +
439
+ $ "{ DiagnosticSeverity . Error } = { errorCount } , " +
440
+ $ "{ DiagnosticSeverity . Warning } = { warningCount } , " +
441
+ $ "{ DiagnosticSeverity . Information } = { infoCount } ") ;
443
442
}
444
443
}
445
444
446
445
if ( EnableExit )
447
446
{
448
- this . Host . SetShouldExit ( diagnosticCounts . Values . Sum ( ) ) ;
447
+ this . Host . SetShouldExit ( diagnosticCount ) ;
449
448
}
450
449
}
451
450
0 commit comments