CppDepend AI
Continuous integration
Run CppDepend on every pull request, so the quality gate is checked for everyone, not just on your machine.
Quickest way (GitHub): cppdepend-ai init --ci github creates the whole workflow for you, with a pull request comment and an optional AI review: see Review. This page is for other CI systems or a hand-written pipeline.
What your pipeline needs
- A machine with CppDepend installed, and a license that allows analyses on it.
- The same 4 steps on any CI system:
1. get the code (with the full git history:
fetch-depth: 0on GitHub) 2. build it 3.cppdepend-ai analyze --run --quiet --project MyApp.cdproj4.cppdepend-ai gate --quiet: the step fails when the quality gate fails - Optionally keep the
cppdependaifolder as a build artifact, even when the gate fails (that is when you need it).
cppdepend-ai is the full path of the program in your CppDepend folder, for example "C:\CppDepend\cppdepend-ai.exe".
GitHub Actions example
name: cppdepend
on: pull_request
jobs:
analyze:
runs-on: [self-hosted, windows]
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- run: cmake --build build --config Release
- run: '& "C:\CppDepend\cppdepend-ai.exe" analyze --run --quiet --project MyApp.cdproj --out cppdependai'
- run: '& "C:\CppDepend\cppdepend-ai.exe" gate --quiet'
- uses: actions/upload-artifact@v4
if: always()
with: { name: cppdepend-ai, path: cppdependai/ }
Azure DevOps and GitLab: the same 4 steps, plus "publish artifact".
Baseline
"New issues" are compared with the baseline of your CppDepend project. For pull requests, make the baseline the analysis of the target branch. If you cannot, use maxTotalIssues in the quality gate.
Exit codes
Useful in scripts: the pipeline reads them to pass or fail.
| Code | Meaning |
|---|---|
| 0 | all good (gate passed, results up to date) |
| 1 | the gate failed, or the results are missing or out of date (status) |
| 2 | wrong command or options, project not found, or a query that does not compile |
| 3 | CppDepend not found (see Troubleshooting) |
| 4 | unexpected error |
Pull request comments
cppdepend-ai review --base origin/main writes a ready-to-post report: see Review.
