aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-11-18 20:04:22 +0100
committerfanquake <fanquake@gmail.com>2022-03-25 08:18:51 +0000
commit67f654ef612c8dbefb969e6e67c286ea2c2e82d6 (patch)
tree72666ce6bc6a04622b5b93415d77c76c3b9f982e /doc
parent95cac2161592fa0dde7d20a0c0ead6d5ae8ac951 (diff)
doc: Document clang-tidy in dev notes
Diffstat (limited to 'doc')
-rw-r--r--doc/developer-notes.md46
1 files changed, 46 insertions, 0 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index bfb64093e1..c3ab3fa953 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -137,11 +137,57 @@ public:
} // namespace foo
```
+Coding Style (C++ named arguments)
+------------------------------
+
+When passing named arguments, use a format that clang-tidy understands. The
+argument names can otherwise not be verified by clang-tidy.
+
+For example:
+
+```c++
+void function(Addrman& addrman, bool clear);
+
+int main()
+{
+ function(g_addrman, /*clear=*/false);
+}
+```
+
+### Running clang-tidy
+
+To run clang-tidy on Ubuntu/Debian, install the dependencies:
+
+```sh
+apt install clang-tidy bear clang
+```
+
+Then, pass clang as compiler to configure, and use bear to produce the `compile_commands.json`:
+
+```sh
+./autogen.sh && ./configure CC=clang CXX=clang++
+make clean && bear make -j $(nproc) # For bear 2.x
+make clean && bear -- make -j $(nproc) # For bear 3.x
+```
+
+To run clang-tidy on all source files:
+
+```sh
+( cd ./src/ && run-clang-tidy -j $(nproc) )
+```
+
+To run clang-tidy on the changed source lines:
+
+```sh
+git diff | ( cd ./src/ && clang-tidy-diff -p2 -j $(nproc) )
+```
+
Coding Style (Python)
---------------------
Refer to [/test/functional/README.md#style-guidelines](/test/functional/README.md#style-guidelines).
+
Coding Style (Doxygen-compatible comments)
------------------------------------------