Skip to content

Commit 10d9b6c

Browse files
committed
Turn on clang-tidy check
1 parent 09107eb commit 10d9b6c

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@
114114
"IWYU",
115115
"nasserts",
116116
"nworkers",
117+
118+
"compdb",
117119
],
118120
// flagWords - list of words to be always considered incorrect
119121
// This is useful for offensive words and common spelling errors.

meson.build

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ PYTHON = find_program('python3')
128128
IWYU = find_program('iwyu_tool.py', required: false, disabler: true)
129129
CSPELL = find_program('cspell', required: false, disabler: true)
130130
GENERATE_LIB_SIZES = find_program('tools' / 'generate_lib_sizes.py')
131+
FILTER_COMPDB = find_program('tools' / 'filter_compdb.py')
131132
DOXYGEN = find_program('doxygen')
132133
SPHINX = find_program('sphinx-build')
133134

@@ -198,17 +199,33 @@ run_target(
198199
]
199200
)
200201

202+
compdb_tidy = custom_target(
203+
'compdb_tidy',
204+
output: 'compile_commands.json',
205+
command: [
206+
FILTER_COMPDB,
207+
meson.project_build_root() / 'compile_commands.json',
208+
'@OUTPUT@',
209+
'-fno-trapv'
210+
]
211+
)
212+
201213
run_target(
202214
'tidy',
203215
command: [
204216
RUN_CLANG_TIDY,
205217
'-clang-tidy-binary',
206218
CLANG_TIDY,
219+
'-j', '@0@'.format(run_command('nproc').stdout().strip()),
220+
'-use-color',
207221
'-quiet',
208222
'-p',
209223
meson.project_build_root(),
210224
files_to_check,
211225
],
226+
depends: [
227+
compdb_tidy,
228+
],
212229
)
213230

214231
run_target(

pixi.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ libs_stubs = "meson compile -C builds/stubs"
2727
libs_posix = "meson compile -C builds/posix"
2828
libs_libuv = "meson compile -C builds/libuv"
2929

30-
stubs = { depends-on = ["setup_stubs", "libs_stubs", "cspell", "doxygen", "sphinx", "iwyu", "style", "cppcheck", "test_stubs"] }
30+
stubs = { depends-on = ["setup_stubs", "libs_stubs", "test_stubs", "cppcheck", "iwyu", "style", "cspell", "tidy"] }
3131
posix = { depends-on = ["setup_posix", "libs_posix", "test_posix"] }
3232
libuv = { depends-on = ["setup_libuv", "libs_libuv", "test_libuv"] }
3333

3434
docs = { depends-on = ["setup_stubs", "doxygen", "sphinx"] }
3535

36-
all = { depends-on = ["stubs", "posix", "libuv"] }
36+
all = { depends-on = ["stubs", "posix", "libuv", "docs"] }
3737

3838
[dependencies]
3939
meson = ">=1.8.1,<2"

tools/filter_compile_commands.py renamed to tools/filter_compdb.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import sys
3232

3333

34-
def filter_compile_commands(input_file, output_file, switches_to_remove):
34+
def filter_compdb(input_file, output_file, switches_to_remove):
3535
"""
3636
Parses the input compile_commands.json, removes specified switches,
3737
and writes the result to output_file.
@@ -67,13 +67,13 @@ def filter_compile_commands(input_file, output_file, switches_to_remove):
6767

6868
if __name__ == "__main__":
6969
if len(sys.argv) != 4:
70-
print("Usage: python filter_compile_commands.py <input_file> <output_file> <switches_to_remove>")
71-
print('Example: python filter_compile_commands.py compile_commands.json filtered_compile_commands.json "-fno-trap"')
70+
print("Usage: python filter_compdb.py <input_file> <output_file> <switches_to_remove>")
71+
print('Example: python filter_compdb.py compile_commands.json compile_commands_filtered.json "-fno-trap"')
7272
sys.exit(1)
7373

7474
input_file = sys.argv[1]
7575
output_file = sys.argv[2]
7676
# Switches are provided as a comma-separated list
7777
switches_to_remove = sys.argv[3].split(',')
7878

79-
filter_compile_commands(input_file, output_file, switches_to_remove)
79+
filter_compdb(input_file, output_file, switches_to_remove)

0 commit comments

Comments
 (0)