Skip to content

Commit e1e665a

Browse files
committed
Add mypy coverage for generate_sbom.py
1 parent 3aaa38b commit e1e665a

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

.github/workflows/mypy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
paths:
1010
- ".github/workflows/mypy.yml"
1111
- "Lib/test/libregrtest/**"
12+
- "Tools/build/generate_sbom.py"
1213
- "Tools/cases_generator/**"
1314
- "Tools/clinic/**"
1415
- "Tools/peg_generator/**"
@@ -34,6 +35,7 @@ jobs:
3435
matrix:
3536
target: [
3637
"Lib/test/libregrtest",
38+
"Tools/build/",
3739
"Tools/cases_generator",
3840
"Tools/clinic",
3941
"Tools/peg_generator",

Tools/build/generate_sbom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def spdx_id(value: str) -> str:
7878
return re.sub(r"[^a-zA-Z0-9.\-]+", "-", value)
7979

8080

81-
def main():
81+
def main() -> None:
8282
root_dir = pathlib.Path(__file__).parent.parent.parent
8383
sbom_path = root_dir / "Misc/sbom.spdx.json"
8484
sbom_data = json.loads(sbom_path.read_bytes())

Tools/build/mypy.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[mypy]
2+
files = Tools/build/generate_sbom.py
3+
pretty = True
4+
5+
# Make sure Python can still be built
6+
# using Python 3.10 for `PYTHON_FOR_REGEN`...
7+
python_version = 3.10
8+
9+
# ...And be strict:
10+
strict = True
11+
strict_concatenate = True
12+
enable_error_code = ignore-without-code,redundant-expr,truthy-bool,possibly-undefined
13+
warn_unreachable = True

0 commit comments

Comments
 (0)