Design & Architecture · New in 2027
Design Enforcement
Write architecture decisions as sentences (“UI must not use Data”), get CQLinq rules, and follow their status at every analysis.
Design Enforcement turns architecture decisions into rules the analysis checks every time. You write them as sentences: “UI must not use Data”, “Services may only use Core”, “this function must not call that one”. CppDepend generates the CQLinq rules and shows the status of every rule after each analysis.
Rules as sentences
| Rule | Reported |
|---|---|
| A must not use B | Types of A that use B, or methods of A that call forbidden functions such as strcpy. |
| A may only use B | Types of A that use project code other than B. |
| A must use B | Types of A that use nothing of B. |
| Classes of A must / must not derive from B | Classes with the wrong base class. |
| Classes of A must be named like R | Classes whose name does not match the pattern. |
Layers and a dependency matrix
Group namespaces, types or functions into layers, then click the cells of a layer matrix: allowed or forbidden. The matrix writes the rules for you. Elements are picked from the code itself, so the names are exact.
Real CQLinq rules
Each sentence becomes a CQLinq rule with a severity, a debt, a reason and a how-to-fix text, in the same layout as the rules shipped with the product:
// <Name>UI must not use Data</Name>
warnif count > 0
from t in Types where t.ParentNamespace.NameLike(@"^.*\.Ui.*$")
let bad = t.TypesUsed.Where(u => u != t && u.ParentNamespace.NameLike(@"^.*\.Data.*$"))
where bad.Any()
select new { t, Uses = bad, Count = bad.Count() }
Your definitions and the generated rules are saved in the project, so the architecture is versioned with the code.
Status of every rule
The Design Enforcement Rules page shows every rule with its status: respected, the number of violations colored by severity, switched off, or not run yet, with tiles for rules, violated, passing and violations. Select a rule to see its query and the violating elements, and double-click to go to the code. Violations appear in the report and can fail a quality gate.
