Treat Compiler Warnings as Error
Ignored compiler warnings can lead to runtime errors, unpredictable behavior or security vulnerabilities; fixing them early prevents production problems and fosters best practices.
Requires Roslyn or R# Analyzers issues to be imported: https://www.ndepend.com/docs/roslyn-analyzer-issue-import https://www.ndepend.com/docs/resharper-code-inspection-issue-import
Compiler warnings are Roslyn issues whose rule id starts with "CS" or "VB". Warns on any warning, fails on 10 or more. C# compiler warnings list: https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0183
Requires Roslyn or R# Analyzers issues to be imported: https://www.ndepend.com/docs/roslyn-analyzer-issue-import https://www.ndepend.com/docs/resharper-code-inspection-issue-import
Compiler warnings are Roslyn issues whose rule id starts with "CS" or "VB". Warns on any warning, fails on 10 or more. C# compiler warnings list: https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0183
CQLinq source
This quality gate is written in CQLinq, C# LINQ over the NDepend code model. It ships with every new NDepend project: you can read it, adapt it, or use it as a starting point for your own custom rules.
// <QualityGate Name="Treat Compiler Warnings as Error" Unit="issues" />
failif count > 10
warnif count > 0
from issue in context.IssuesSet.AllIssues.Where(
i => (i.Rule.Provider == RuleProvider.Roslyn &&
i.Rule.Id.StartsWithAny("CS","VB")) ||
(i.Rule.Provider == RuleProvider.Resharper &&
i.Rule.Category.EndsWith("CompilerWarnings")))
select new { issue, Explanation =issue.GetExplanation() }
//<Desc>
// Ignored compiler warnings can lead to runtime errors, unpredictable
// behavior or security vulnerabilities; fixing them early prevents production
// problems and fosters best practices.
//
// Requires Roslyn or R# Analyzers issues to be imported:
// https://www.ndepend.com/docs/roslyn-analyzer-issue-import
// https://www.ndepend.com/docs/resharper-code-inspection-issue-import
//
// Compiler warnings are Roslyn issues whose rule id starts with "CS" or "VB".
// Warns on any warning, fails on 10 or more. C# compiler warnings list:
// https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0183
//</Desc>
Open in the interactive Rules Explorer · All default rules
Quality Gates: all 19 items
- Quality Gates Evolution
- Percentage Coverage
- Percentage Coverage on New Code
- Percentage Coverage on Refactored Code
- Percentage Coverage (JustMyCode)
- Percentage Coverage on New Code (JustMyCode)
- Percentage Coverage on Refactored Code (JustMyCode)
- Blocker Issues
- Critical Issues
- New Blocker / Critical / High Issues
- Critical Rules Violated
- Treat Compiler Warnings as Error
- Percentage Debt
- Debt
- New Debt since Baseline
- Debt Rating per Namespace
- Annual Interest
- New Annual Interest since Baseline
- Unnecessary NDepend SuppressMessageAttribute Usage