File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -137,11 +137,57 @@ public:
137137} // namespace foo
138138```
139139
140+ Coding Style (C++ named arguments)
141+ ------------------------------
142+
143+ When passing named arguments, use a format that clang-tidy understands. The
144+ argument names can otherwise not be verified by clang-tidy.
145+
146+ For example:
147+
148+ ``` c++
149+ void function (Addrman& addrman, bool clear);
150+
151+ int main()
152+ {
153+ function(g_addrman, /* clear=* /false);
154+ }
155+ ```
156+
157+ ### Running clang-tidy
158+
159+ To run clang-tidy on Ubuntu/Debian, install the dependencies:
160+
161+ ```sh
162+ apt install clang-tidy bear clang
163+ ```
164+
165+ Then, pass clang as compiler to configure, and use bear to produce the ` compile_commands.json ` :
166+
167+ ``` sh
168+ ./autogen.sh && ./configure CC=clang CXX=clang++
169+ make clean && bear make -j $( nproc) # For bear 2.x
170+ make clean && bear -- make -j $( nproc) # For bear 3.x
171+ ```
172+
173+ To run clang-tidy on all source files:
174+
175+ ``` sh
176+ ( cd ./src/ && run-clang-tidy -j $( nproc) )
177+ ```
178+
179+ To run clang-tidy on the changed source lines:
180+
181+ ``` sh
182+ git diff | ( cd ./src/ && clang-tidy-diff -p2 -j $( nproc) )
183+ ```
184+
140185Coding Style (Python)
141186---------------------
142187
143188Refer to [ /test/functional/README.md#style-guidelines] ( /test/functional/README.md#style-guidelines ) .
144189
190+
145191Coding Style (Doxygen-compatible comments)
146192------------------------------------------
147193
You can’t perform that action at this time.
0 commit comments