KDE CI adds clang-tidy, clazy and compiler warnings to merge request code quality reports
KDE's shared CI tooling can now surface compiler warnings and clang-tidy/clazy findings directly in GitLab merge request code quality widgets, with optional pipeline gating.
Summary
KDE's CI infrastructure has gained opt-in support for reporting compiler warnings and clang-tidy results, including the clazy Qt-specific plugin, inside GitLab's merge request code quality widget. Previously compiler warnings were only visible in raw build logs, and projects wanting clang-tidy or clazy had to maintain their own CI scripts. The new options hook into the regular build so each warning emitted for a file in the repository becomes a code quality report entry, which GitLab diffs against the target branch to show only what a merge request introduces or fixes.
The existing cppcheck job remains the fast, build-free first pass, while the new analysis runs only in the main Linux job (currently suse_tumbleweed_qt612 from the linux-qt6.yml template) so results are not duplicated in the Qt next job or on other platforms. Projects enable the behavior through .kde-ci.yml options such as report-compiler-warnings, run-clang-tidy and require-clang-tidy-clean, and clang-tidy requires a .clang-tidy file at the repository root. The change landed as ci-utilities MR !758, building on earlier work in !532 and !651, with Dolphin MR !1568 as the first real adopter.
How the new KDE CI code quality pipeline works
- Compiler warning capture: With report-compiler-warnings: true, every warning the build prints for a repository file is turned into a code quality report entry, and GitLab compares it against the target branch so the merge request shows only newly introduced or fixed warnings.
- clang-tidy with clazy: run-clang-tidy executes on the real compile commands with full include paths, defines and Qt headers; loading the clazy plugin adds Qt-aware checks such as container detaching in range loops, QString misuse and incorrect connect calls.
- Check selection and duplication avoidance: Checks are not chosen by CI but by the project's .clang-tidy; when compiler warnings are also reported, modernize-use-override and modernize-use-nullptr should be omitted because ECM's KDECompilerSettings already enables -Wsuggest-override and -Wzero-as-null-pointer-constant for GCC.
- Wildcard and performance caveats: clazy-* enables every clazy check including manual checks clazy marks as false-positive-prone or stylistic (clazy-reserve-candidates, clazy-isempty-vs-count, clazy-qrequiredresult-candidates), and clang-analyzer-* finds real bugs but slows the build because it runs on every translation unit.
- Pipeline gating and scope: require-clang-tidy-clean can fail the pipeline on findings, mirroring require-cppcheck-clean; analysis runs only in the main Linux job from linux-qt6.yml, not in the Qt next job or on other platforms, and clang-tidy-arguments passes extra flags when needed.
Why it matters
KDE is one of the largest C++/Qt codebases in the open source world, and moving static analysis results from buried logs into merge request widgets lowers the barrier for contributors to notice and fix warnings as they touch code. The opt-in, per-project .clang-tidy model lets maintainers tune noise levels gradually rather than blocking all development at once, which matters for older modules with hundreds of pre-existing findings. Other projects using GitLab CI and Qt can copy the pattern, and Dolphin's configuration serves as a concrete reference for adopting clazy levels 0 and 1.
Original reference: blogs.kde.org →