Skip to content

Commit

Permalink
Merge pull request #644 from sharwell/set-severity
Browse files Browse the repository at this point in the history
Set default severity explicitly
  • Loading branch information
sharwell authored Oct 21, 2020
2 parents 25d9357 + 7add773 commit fd540c1
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,14 @@ protected virtual Project ApplyCompilationOptions(Project project)
foreach (var diagnostic in analyzer.SupportedDiagnostics)
{
// make sure the analyzers we are testing are enabled
supportedDiagnosticsSpecificOptions[diagnostic.Id] = ReportDiagnostic.Default;
supportedDiagnosticsSpecificOptions[diagnostic.Id] = diagnostic.DefaultSeverity switch
{
DiagnosticSeverity.Hidden => ReportDiagnostic.Hidden,
DiagnosticSeverity.Info => ReportDiagnostic.Info,
DiagnosticSeverity.Warning => ReportDiagnostic.Warn,
DiagnosticSeverity.Error => ReportDiagnostic.Error,
_ => throw new InvalidOperationException(),
};
}
}

Expand Down

0 comments on commit fd540c1

Please sign in to comment.