Skip to content

Commit 2db2e63

Browse files
committed
Merge bitcoin/bitcoin#35869: lint: (re-)add contrib/guix for Python linting
8221d714c7888cbcf44971ab279effde505707a9 lint: document CI lief version requirement (fanquake) 594a02c3ae05ae4985f6647c7ffb94d615b7a8a1 lint: re-add guix scripts to mypy linting (fanquake) Pull request description: These were no-longer being linted after bitcoin/bitcoin#32458. suppress `[union-attr]` warning. i.e: ```bash contrib/guix/symbol-check.py:309: error: Item "None" of "lief.PE.Binary | lief.ELF.Binary | lief.MachO.Binary | lief.COFF.Binary | None" has no attribute "format" [union-attr] contrib/guix/security-check.py:284: error: Item "lief.COFF.Binary" of "lief.PE.Binary | lief.ELF.Binary | lief.MachO.Binary | lief.COFF.Binary | None" has no attribute "abstract" [union-attr] ``` Add the comment suggested in [#35855.](bitcoin/bitcoin#35855 (comment)). ACKs for top commit: maflcko: lgtm ACK 8221d714c7888cbcf44971ab279effde505707a9 in any case. hebasto: ACK 8221d714c7888cbcf44971ab279effde505707a9, I have reviewed the code and it looks OK. Tree-SHA512: ec404a8235fd40b212aad71ee3fe3473a3ce6f1ebaed46661d36ef02862b08528e3b6b829e05c5b943c8543380f3876e33da725154ce31d4022ad39ae5ef5ab3
2 parents f812e04 + a844003 commit 2db2e63

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

ci/lint/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# lief version should match the version used in Guix
12
lief==0.17.5
23
mypy==2.3.0
34
pyzmq==27.1.0

contrib/guix/security-check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ def check_MACHO_BRANCH_PROTECTION(binary) -> bool:
280280
for filename in sys.argv[1:]:
281281
binary = lief.parse(filename)
282282

283-
etype = binary.format
284-
arch = binary.abstract.header.architecture
283+
etype = binary.format # type: ignore[union-attr]
284+
arch = binary.abstract.header.architecture # type: ignore[union-attr]
285285

286286
failed: list[str] = []
287287
for (name, func) in CHECKS[etype][arch]:

contrib/guix/symbol-check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def check_ELF_ABI(binary) -> bool:
306306
for filename in sys.argv[1:]:
307307
binary = lief.parse(filename)
308308

309-
etype = binary.format
309+
etype = binary.format # type: ignore[union-attr]
310310

311311
failed: list[str] = []
312312
for (name, func) in CHECKS[etype]:

test/lint/lint-python.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
DEPS = ['lief', 'mypy', 'pyzmq']
2222

23-
# Only .py files in test/functional and contrib/devtools have type annotations
23+
# Only .py files in test/functional and contrib/(devtools|guix) have type annotations
2424
# enforced.
25-
MYPY_FILES_ARGS = ['git', 'ls-files', 'test/functional/*.py', 'contrib/devtools/*.py']
25+
MYPY_FILES_ARGS = ['git', 'ls-files', 'test/functional/*.py', 'contrib/devtools/*.py', 'contrib/guix/*.py']
2626

2727

2828
def check_dependencies():

0 commit comments

Comments
 (0)