CppDepend AI
Quality gate
The quality gate is your rule for "this change is acceptable". cppdepend-ai gate checks it against the latest analysis and fails when quality got worse. After cppdepend-ai init, the file cppdepend-ai.gate.json is in your repository: edit it to match your team's rules. Every line is optional, and // comments are allowed.
{
"failOnNewIssues": [ "Blocker", "Critical" ], // any NEW issue of these severities fails
"maxNewIssues": { "High": 0, "Medium": 10 }, // maximum number of NEW issues per severity
"maxTotalIssues": { "Blocker": 0 }, // maximum number of issues (new or old) per severity
"maxNamespaceCycles": 0, // remove this line to disable
"minCoveragePercent": 60, // only checked when code coverage is imported in CppDepend
"queries": [
"failif count > 0 from t in Application.Types where t.CyclomaticComplexity > 500 select t"
]
}
Severities: Blocker, Critical, High, Medium, Low. The queries entries are your own CQLinq rules.
Without a gate file: new Blocker or Critical issues fail, and no Blocker issue is allowed at all.
"New" means new compared with the baseline of your CppDepend project. Without a baseline nothing is new: use maxTotalIssues instead.
Adopting it on an existing code base
Set the baseline to today, and keep failOnNewIssues for Blocker and Critical. Only new problems fail, so you do not have to fix years of history first. Tighten the other limits as your team agrees.
Where to check it
- On your machine: run
cppdepend-ai gate, or ask your assistant to run it before it says a task is done. - On every pull request: see Continuous integration. That is the check that counts.
