# Rules
Counts active rules: violated or not, critical or not. Without a baseline, rules relying on diff are not counted, which can explain an unexpected slight decrease of this count.
CQLinq source
This trend metric 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.
// <TrendMetric Name="# Rules" Unit="rules"/>
from rule in Rules
select new {
rule,
issues = rule.Issues(),
debt = rule.Debt(),
annualInterest = rule.AnnualInterest(),
maxSeverity = rule.IsViolated() && rule.Issues().Any() ?
(Severity?)rule.Issues().Max(i => i.Severity) : null
}
//<Desc>
// Counts active rules: violated or not, critical or not. Without a
// baseline, rules relying on diff are not counted, which can explain an
// unexpected slight decrease of this count.
//</Desc>
Open in the interactive Rules Explorer · All default rules