Skip to content

Commit 93848ed

Browse files
Update cpp_linter_hooks/clang_tidy.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 0252a86 commit 93848ed

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

cpp_linter_hooks/clang_tidy.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,16 @@ def run_clang_tidy(args=None) -> Tuple[int, str]:
152152
other_args = ["-p", compile_db_path] + other_args
153153

154154
clang_tidy_args, source_files = _split_source_files(other_args)
155-
if hook_args.jobs > 1 and len(source_files) > 1:
155+
156+
# Parallel execution is unsafe when arguments include flags that write to a
157+
# shared output path (e.g., --export-fixes fixes.yaml). In that case, force
158+
# serial execution to avoid concurrent writes/overwrites.
159+
unsafe_parallel = any(
160+
arg == "--export-fixes" or arg.startswith("--export-fixes=")
161+
for arg in clang_tidy_args
162+
)
163+
164+
if hook_args.jobs > 1 and len(source_files) > 1 and not unsafe_parallel:
156165
return _exec_parallel_clang_tidy(
157166
["clang-tidy"] + clang_tidy_args, source_files, hook_args.jobs
158167
)

0 commit comments

Comments
 (0)