Skip to content

Commit 5ffabf9

Browse files
committed
scripts & workflows alignment
1 parent a730d4b commit 5ffabf9

5 files changed

Lines changed: 33 additions & 20 deletions

File tree

.github/workflows/clang.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ jobs:
3232

3333
- name: Run tests
3434
run: |
35-
./build/tests/run
36-
continue-on-error: false
35+
./build/tests/gl
36+
./build/tests/hgl

.github/workflows/gpp.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ jobs:
3232

3333
- name: Run tests
3434
run: |
35-
./build/tests/run
35+
./build/tests/
36+
./build/tests/hgl

pyrightconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"include": ["scripts"],
3+
"typeCheckingMode": "basic",
4+
"reportImplicitRelativeImport": false,
5+
"reportUnusedCallResult": false
6+
}

scripts/common.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33

44
def find_files(
5-
search_paths: list[str],
6-
file_patterns: list[str],
7-
exclude_paths: list[str]
5+
search_paths: list[str], file_patterns: list[str], exclude_paths: list[str]
86
) -> set[Path]:
97
matching_files = []
108
for search_path in search_paths:
@@ -13,7 +11,8 @@ def find_files(
1311
matching_files.extend(path.rglob(pattern))
1412

1513
filtered_files = {
16-
file for file in matching_files
14+
file
15+
for file in matching_files
1716
if not any(str(file.parent).startswith(path) for path in exclude_paths)
1817
}
1918

scripts/format.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,47 @@ class DefaultParameters:
1717
def parse_args():
1818
parser = argparse.ArgumentParser()
1919
parser.add_argument(
20-
"-m", "--modified-files",
20+
"-m",
21+
"--modified-files",
2122
type=bool,
2223
default=DefaultParameters.modified_files,
2324
action=argparse.BooleanOptionalAction,
24-
help="run clang-format only on the files modified since last pushed commit"
25+
help="run clang-format only on the files modified since last pushed commit",
2526
)
2627
parser.add_argument(
27-
"-p", "--search-paths",
28+
"-p",
29+
"--search-paths",
2830
type=str,
2931
default=DefaultParameters.search_paths,
3032
nargs="*",
3133
action="extend",
32-
help="list of search directory paths"
34+
help="list of search directory paths",
3335
)
3436
parser.add_argument(
35-
"-f", "--file-patterns",
37+
"-f",
38+
"--file-patterns",
3639
type=str,
3740
default=DefaultParameters.file_patterns,
3841
nargs="*",
3942
action="extend",
40-
help="list of file patterns to include"
43+
help="list of file patterns to include",
4144
)
4245
parser.add_argument(
43-
"-e", "--exclude-paths",
46+
"-e",
47+
"--exclude-paths",
4448
type=str,
4549
default=DefaultParameters.exclude_paths,
4650
nargs="*",
4751
action="extend",
48-
help="list of directory paths to exclude"
52+
help="list of directory paths to exclude",
4953
)
5054
parser.add_argument(
51-
"-c", "--check",
55+
"-c",
56+
"--check",
5257
type=bool,
5358
default=DefaultParameters.check,
5459
action=argparse.BooleanOptionalAction,
55-
help="run format check"
60+
help="run format check",
5661
)
5762

5863
return vars(parser.parse_args())
@@ -65,7 +70,7 @@ def get_modified_files(files: set[Path]) -> set[Path]:
6570
check=True,
6671
stdout=subprocess.PIPE,
6772
stderr=subprocess.PIPE,
68-
text=True
73+
text=True,
6974
)
7075

7176
modified_files = {Path(file) for file in result.stdout.splitlines() if file}
@@ -95,7 +100,9 @@ def run_clang_format(files: set[Path], check: bool) -> int:
95100
result = subprocess.run(cmd, capture_output=True, text=True)
96101
if result.returncode != 0:
97102
return_code = result.returncode
98-
print(f"[Format error]\n[stdout]\n{result.stdout}\n[stderr]\n{result.stderr}")
103+
print(
104+
f"[Format error]\n[stdout]\n{result.stdout}\n[stderr]\n{result.stderr}"
105+
)
99106

100107
print("Done!")
101108
return return_code
@@ -106,7 +113,7 @@ def main(
106113
search_paths: list[str],
107114
file_patterns: list[str],
108115
exclude_paths: list[str],
109-
check: bool
116+
check: bool,
110117
):
111118
files_to_format = find_files(search_paths, file_patterns, exclude_paths)
112119
if modified_files:

0 commit comments

Comments
 (0)