|
12 | 12 | print(f"{len(cpp_files)} C++ files were modified.")
|
13 | 13 | if not cpp_files:
|
14 | 14 | 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 |
| - ) |
29 | 15 |
|
30 |
| - subprocess.run( |
31 |
| - ["clang-format", "-i", "-style=file", *cpp_files], |
32 |
| - check=True, |
33 |
| - text=True, |
34 |
| - stderr=subprocess.STDOUT, |
35 |
| - ) |
36 |
| - |
37 |
| - upper_files = [file for file in cpp_files if file != file.lower()] |
38 |
| - if upper_files: |
39 |
| - print(f"{len(upper_files)} files contain uppercase characters:") |
40 |
| - print("\n".join(upper_files) + "\n") |
41 |
| - |
42 |
| - space_files = [file for file in cpp_files if " " in file or "-" in file] |
43 |
| - if space_files: |
44 |
| - print(f"{len(space_files)} files contain space or dash characters:") |
45 |
| - print("\n".join(space_files) + "\n") |
46 |
| - |
47 |
| - nodir_files = [file for file in cpp_files if file.count(os.sep) != 1] |
48 |
| - if nodir_files: |
49 |
| - print(f"{len(nodir_files)} files are not in one and only one directory:") |
50 |
| - print("\n".join(nodir_files) + "\n") |
51 |
| - |
52 |
| - bad_files = len(upper_files + space_files + nodir_files) |
53 |
| - if bad_files: |
54 |
| - 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) |
0 commit comments