Skip to content

Commit ca65f84

Browse files
committed
Put clang-format & clang-tidy in different headings
1 parent 017f5f5 commit ca65f84

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# -- Project information -----------------------------------------------------
2121

2222
project = 'Cutter'
23-
copyright = '2020, The Cutter Developers'
23+
copyright = '2026, The Cutter Developers'
2424
author = 'The Cutter Developers'
2525

2626
# The short X.Y version

docs/source/contributing/code/development-guidelines.rst

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ so your widget refreshes its output when Rizin seek is modified
5151
Coding Style
5252
------------
5353

54+
clang-format
55+
~~~~~~~~~~~~
56+
5457
In general, we follow a slightly customized version of `the official Qt guidelines <https://wiki.qt.io/Qt_Coding_Style>`__
5558
to format the code. Before sending a pull request, you will need to use `clang-format <https://clang.llvm.org/docs/ClangFormat.html>`__ (version 8 or newer)
5659
to format the code. The command line for formatting the code according
@@ -66,6 +69,9 @@ If your changes were done on many files across the codebase, you can use this on
6669
6770
find ./src -regex '.*\.\(cpp\|h\)' -exec clang-format -style=file -i {} \;
6871
72+
clang-tidy
73+
~~~~~~~~~~
74+
6975
Beyond formatting, we use `clang-tidy <https://clang.llvm.org/extra/clang-tidy/>`__ (version 13 or newer) to catch potential style violations.
7076

7177
To run ``clang-tidy``, first configure your build to generate ``compile_commands.json`` and run the autogen tools:
@@ -88,12 +94,49 @@ Similar to ``clang-format``, If your changes were done on many files across the
8894
8995
run-clang-tidy -p build "src/(?!(themes|bindings|fonts|img|translations|build|.*_autogen)).*\.(cpp|h)$"
9096
91-
``clang-tidy`` can also attempt to fix style violations using the ``-fix`` flag, however these may not always be perfect. Make sure to verify the fixes before opening a pull request:
97+
``clang-tidy`` can also attempt to fix style violations using the ``-fix`` flag. However these may not always be perfect, as an example ``clang-tidy`` puts the const qualifier on the right side of type name whereas it is preferred to be on the left in cutter. Make sure to verify the fixes before opening a pull request:
9298

9399
.. code:: bash
94100
95101
git diff -U0 --no-color HEAD~1 | clang-tidy-diff.py -fix -p1 -path build/
96102
103+
Python scripts
104+
~~~~~~~~~~~~~~
105+
106+
If you don't want to run manual commands, cutter also provides scripts for running ``clang-format`` and ``clang-tidy`` in the ``scripts`` directory
107+
108+
.. code:: bash
109+
110+
python scripts/clang-format.py -h
111+
usage: clang-format.py [-h] [-C CLANG_FORMAT] [-c] [-v] [-f FILE] [-d DIFF]
112+
113+
Clang format the cutter project
114+
115+
options:
116+
-h, --help show this help message and exit
117+
-C, --clang-format CLANG_FORMAT
118+
path of clang-format
119+
-c, --check enable the check mode
120+
-v, --verbose use verbose output
121+
-f, --file FILE formats (or checks) only the given file
122+
-d, --diff DIFF format all modified file related to branch
123+
124+
.. code:: bash
125+
126+
python scripts/clang-tidy.py -h
127+
usage: clang-tidy.py [-h] [-T RUN_CLANG_TIDY] [-p BUILD_PATH] [-f FILE] [-i]
128+
129+
clang-tidy wrapper
130+
131+
options:
132+
-h, --help show this help message and exit
133+
-T, --run-clang-tidy RUN_CLANG_TIDY
134+
Path of run-clang-tidy binary
135+
-p, --build-path BUILD_PATH
136+
Path to the build directory
137+
-f, --file FILE Check a specific file only
138+
-i, --fix Apply fixes automatically
139+
97140
98141
Below are some of the low level coding conventions that we follow
99142

0 commit comments

Comments
 (0)