@@ -416,36 +416,35 @@ protected override void EndProcessing()
416416 ScriptAnalyzer . Instance . CleanUp ( ) ;
417417 base . EndProcessing ( ) ;
418418
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 ( ) ;
423420
424421 if ( ReportSummary . IsPresent )
425422 {
426- var numberOfRuleViolations = infoCount + warningCount + errorCount ;
427- if ( numberOfRuleViolations == 0 )
423+ if ( diagnosticCount == 0 )
428424 {
429425 Host . UI . WriteLine ( "0 rule violations found." ) ;
430426 }
431427 else
432428 {
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 } ") ;
443442 }
444443 }
445444
446445 if ( EnableExit )
447446 {
448- this . Host . SetShouldExit ( diagnosticCounts . Values . Sum ( ) ) ;
447+ this . Host . SetShouldExit ( diagnosticCount ) ;
449448 }
450449 }
451450
0 commit comments