doc: clarify clang-tidy in developer notes
What changed, and why it matters
This is a documentation-only change to the developer notes. It adds clearer instructions for running the clang-tidy code-quality tool on Bitcoin Core. There are no code changes, no security fixes, and no behavior changes to the Bitcoin software itself.
No security action needed. Treat as a normal documentation improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies doc/developer-notes.md to expand guidance on invoking clang-tidy: clarifying that cmake should export compile_commands.json, showing how to run clang-tidy on a single file, and mentioning the -quiet and -fix flags. The diff touches only documentation lines; no source code, build scripts, tests, or configuration files are changed.
Changed components
doc/developer-notes.mdInspect captured patch +9 / −2
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index 18691811..f552b1d7 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -164,7 +164,7 @@ To run clang-tidy on Ubuntu/Debian, install the dependencies:
apt install clang-tidy clang
```
-Configure with clang as the compiler:
+Configure with clang as the compiler with the below command that should create a `compile_commands.json` file within the build directory:
```sh
cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
@@ -172,12 +172,19 @@ cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXP
The output is denoised of errors from external dependencies.
-To run clang-tidy on all source files:
+To run clang-tidy on all source files using the checks mentioned in the `./src/.clang-tidy` file:
```sh
( cd ./src/ && run-clang-tidy -p ../build -j $(nproc) )
```
+To run clang-tidy on one file:
+```sh
+( cd ./src/ && run-clang-tidy -p ../build -j $(nproc) ./path/to/single_file.cpp )
+```
+
+Optionally, append the `run-clang-tidy` command with the `-quiet` option to suppress printing of statistics and ignored warnings that can clutter the output. The `-fix` option also comes in handy to apply the fixes suggested by the tool but need to ensure that unrelated changes in the file are not committed.
+
To run clang-tidy on the changed source lines:
```sh
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.