@@ -377,9 +377,12 @@ Running Clang-Tidy on Diff
377377
378378The :program: `clang-tidy-diff.py ` script allows you to run :program: `clang-tidy `
379379only on the lines that have been modified in your working directory or in a
380- specific diff. This is particularly useful for code reviews and continuous
381- integration, as it focuses analysis on the changed code rather than the entire
382- codebase.
380+ specific diff. Importantly, clang-tidy-diff will only analyze and report
381+ warnings from the changed lines. The script is essentially a wrapper that
382+ parses diff output and passes it to :program: `clang-tidy ` with the
383+ ``--line-filter `` option, which performs all the actual filtering. This is
384+ particularly useful for code reviews and continuous integration, as it focuses
385+ analysis on the changed code rather than the entire codebase.
383386
384387The script can work with various diff sources:
385388
@@ -412,6 +415,20 @@ diff, which is typically needed for Git diffs. The script supports most of the
412415same options as :program: `clang-tidy ` itself, including ``-checks= ``, ``-fix ``,
413416``-header-filter= ``, and configuration options.
414417
418+ While :program: `clang-tidy-diff.py ` is useful for focusing on recent changes,
419+ relying solely on it may lead to incomplete analysis. Since the script only
420+ reports warnings from the modified lines, it may miss issues that are caused
421+ by the changes but manifest elsewhere in the code. For example, changes that
422+ only add lines to a function may cause it to violate size limits (e.g.,
423+ ``readability-function-size ``), but the diagnostic will be reported at the
424+ function declaration, which may not be in the diff and thus filtered out.
425+ Modifications to header files may also affect many implementation files, but
426+ only warnings in the modified header lines will be reported.
427+
428+ For comprehensive analysis, especially before merging significant changes,
429+ consider running :program: `clang-tidy ` on the entire affected files or the
430+ whole project using :program: `run-clang-tidy.py `.
431+
415432.. _clang-tidy-nolint :
416433
417434Suppressing Undesired Diagnostics
0 commit comments