lint: re-add guix scripts to mypy linting
What changed, and why it matters
This commit is a routine linting fix. It re-adds some Guix build helper scripts to the Python type-checker (mypy) configuration and adds two comment-only annotations to suppress false-positive type warnings. There is no change to Bitcoin Core's runtime behavior, consensus rules, wallet handling, or network code.
No security action required. This is a development tooling/linting change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies test/lint/lint-python.py to include contrib/guix/*.py in the mypy file list again after they were accidentally dropped by PR #32458. It also adds ‘# type: ignore[union-attr]’ comments on two attribute accesses in contrib/guix/security-check.py and contrib/guix/symbol-check.py where lief.parse() can return None or a union type that mypy narrows conservatively. The executable code is identical; only type-checker directives and lint configuration changed.
Changed components
test/lint/lint-python.pycontrib/guix/security-check.pycontrib/guix/symbol-check.pyInspect captured patch +5 / −5
diff --git a/contrib/guix/security-check.py b/contrib/guix/security-check.py
index 2a6e26b6..87aafcb9 100755
--- a/contrib/guix/security-check.py
+++ b/contrib/guix/security-check.py
@@ -280,8 +280,8 @@ if __name__ == '__main__':
for filename in sys.argv[1:]:
binary = lief.parse(filename)
- etype = binary.format
- arch = binary.abstract.header.architecture
+ etype = binary.format # type: ignore[union-attr]
+ arch = binary.abstract.header.architecture # type: ignore[union-attr]
failed: list[str] = []
for (name, func) in CHECKS[etype][arch]:
diff --git a/contrib/guix/symbol-check.py b/contrib/guix/symbol-check.py
index 86b79652..8c313e3d 100755
--- a/contrib/guix/symbol-check.py
+++ b/contrib/guix/symbol-check.py
@@ -306,7 +306,7 @@ if __name__ == '__main__':
for filename in sys.argv[1:]:
binary = lief.parse(filename)
- etype = binary.format
+ etype = binary.format # type: ignore[union-attr]
failed: list[str] = []
for (name, func) in CHECKS[etype]:
diff --git a/test/lint/lint-python.py b/test/lint/lint-python.py
index fd1a8495..d8d6f44f 100755
--- a/test/lint/lint-python.py
+++ b/test/lint/lint-python.py
@@ -20,9 +20,9 @@ os.environ["MYPY_CACHE_DIR"] = str(cache_dir)
DEPS = ['lief', 'mypy', 'pyzmq']
-# Only .py files in test/functional and contrib/devtools have type annotations
+# Only .py files in test/functional and contrib/(devtools|guix) have type annotations
# enforced.
-MYPY_FILES_ARGS = ['git', 'ls-files', 'test/functional/*.py', 'contrib/devtools/*.py']
+MYPY_FILES_ARGS = ['git', 'ls-files', 'test/functional/*.py', 'contrib/devtools/*.py', 'contrib/guix/*.py']
def check_dependencies():
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.