Skip to content

Commit 2fd4044

Browse files
chore: fix file formatter
1 parent 643e0a9 commit 2fd4044

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

scripts/file_linter.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,33 @@
66
with open("git_diff.txt") as in_file:
77
modified_files = sorted(in_file.read().splitlines())
88
print("{} files were modified.".format(len(modified_files)))
9-
9+
1010
cpp_exts = tuple(".c .c++ .cc .cpp .cu .cuh .cxx .h .h++ .hh .hpp .hxx".split())
1111
cpp_files = [file for file in modified_files if file.lower().endswith(cpp_exts)]
1212
print(f"{len(cpp_files)} C++ files were modified.")
1313
if not cpp_files:
1414
sys.exit(0)
15+
else:
16+
subprocess.run(
17+
[
18+
"clang-tidy",
19+
"--fix",
20+
"-p=build",
21+
"--extra-arg=-std=c++11",
22+
*cpp_files,
23+
"--",
24+
],
25+
check=True,
26+
text=True,
27+
stderr=subprocess.STDOUT,
28+
)
1529

16-
subprocess.run(["clang-tidy", "--fix", "-p=build", "--extra-arg=-std=c++11", *cpp_files, "--"],
17-
check=True, text=True, stderr=subprocess.STDOUT)
18-
19-
subprocess.run(["clang-format", "-i", "-style=file", *cpp_files],
20-
check=True, text=True, stderr=subprocess.STDOUT)
30+
subprocess.run(
31+
["clang-format", "-i", "-style=file", *cpp_files],
32+
check=True,
33+
text=True,
34+
stderr=subprocess.STDOUT,
35+
)
2136

2237
upper_files = [file for file in cpp_files if file != file.lower()]
2338
if upper_files:

0 commit comments

Comments
 (0)