diff --git a/d6/d02/file__linter_8py_source.html b/d6/d02/file__linter_8py_source.html index 17be1b368..139e16042 100644 --- a/d6/d02/file__linter_8py_source.html +++ b/d6/d02/file__linter_8py_source.html @@ -124,37 +124,47 @@ $(function(){initNavTree('d6/d02/file__linter_8py_source.html','../../',''); });
6with open("git_diff.txt") as in_file:
7 modified_files = sorted(in_file.read().splitlines())
8 print("{} files were modified.".format(len(modified_files)))
-
9
+
9
10 cpp_exts = tuple(".c .c++ .cc .cpp .cu .cuh .cxx .h .h++ .hh .hpp .hxx".split())
11 cpp_files = [file for file in modified_files if file.lower().endswith(cpp_exts)]
12 print(f"{len(cpp_files)} C++ files were modified.")
13 if not cpp_files:
14 sys.exit(0)
15
-
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)
-
21
-
22 upper_files = [file for file in cpp_files if file != file.lower()]
-
23 if upper_files:
-
24 print(f"{len(upper_files)} files contain uppercase characters:")
-
25 print("\n".join(upper_files) + "\n")
-
26
-
27 space_files = [file for file in cpp_files if " " in file or "-" in file]
-
28 if space_files:
-
29 print(f"{len(space_files)} files contain space or dash characters:")
-
30 print("\n".join(space_files) + "\n")
-
31
-
32 nodir_files = [file for file in cpp_files if file.count(os.sep) != 1]
-
33 if nodir_files:
-
34 print(f"{len(nodir_files)} files are not in one and only one directory:")
-
35 print("\n".join(nodir_files) + "\n")
-
36
-
37 bad_files = len(upper_files + space_files + nodir_files)
-
38 if bad_files:
-
39 sys.exit(bad_files)
+
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 )
+
29 subprocess.run(
+
30 ["clang-format", "-i", "-style=file", *cpp_files],
+
31 check=True,
+
32 text=True,
+
33 stderr=subprocess.STDOUT,
+
34 )
+
35 upper_files = [file for file in cpp_files if file != file.lower()]
+
36 if upper_files:
+
37 print(f"{len(upper_files)} files contain uppercase characters:")
+
38 print("\n".join(upper_files) + "\n")
+
39 space_files = [file for file in cpp_files if " " in file or "-" in file]
+
40 if space_files:
+
41 print(f"{len(space_files)} files contain space or dash characters:")
+
42 print("\n".join(space_files) + "\n")
+
43 nodir_files = [file for file in cpp_files if file.count(os.sep) != 1]
+
44 if nodir_files:
+
45 print(f"{len(nodir_files)} files are not in one and only one directory:")
+
46 print("\n".join(nodir_files) + "\n")
+
47 bad_files = len(upper_files + space_files + nodir_files)
+
48 if bad_files:
+
49 sys.exit(bad_files)