Proj4030: Avoid global diagnostic suppression
Using dotnet_diagnostic.severity = none acts as a nuclear option that disables
reporting for all code analysis rules and, depending on the .NET SDK version,
can even silence critical core C# compiler warnings (CSxxxx).
This configuration introduces two major risks to a codebase:
- It hides (potentially) critical bugs
- Performance-wise, there are better alternatives to achieve this.
Non-compliant
is_global = true
dotnet_diagnostic.severity = none
Compliant
Alternative 1
Specify on a rule-by-rule base that a rule is disabled, and explain why:
is_global = true
dotnet_diagnostic.QW0001.severity = none # Use a testable Time Provider [Justification: Similar to S6354.]
Alternative 2
If you only want to silence noisy non-critical rules (like code formatting or minor design preferences) while keeping compiler and security safety nets active, suppress by category:
is_global = true
dotnet_analyzer_diagnostic.category-Style.severity = none
dotnet_analyzer_diagnostic.category-Design.severity = none
Alternative 3
If the goal is a temporary performance optimization during local development,
disabling the analyzers entirely via MSBuild is a vastly superior option.
Unlike the non-compliant configuration, this saves CPU cycles and safely leaves
core compiler warnings (CSxxxx) intact.
dotnet build /p:RunAnalyzersDuringBuild=false