Skip to content

Commit 3bf40d0

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#23212: lint: enable mypy import checking
a46f71b lint: enable mypy checking for missing imports (josibake) 22e6526 lint mypy 0.910 (fanquake) 6ae9c2e lint: install pyzmq (22.3.0) into linter environment (josibake) b93e229 doc: remove pointlessly duplicated linter version / install info (fanquake) Pull request description: This is #22844 with issues addressed, and two additional commits. One to move to the latest mypy version in the CI, and another to remove what is just pointless duplication from the test README. There's no need to relist package versions and install instructions (meaning 2x the work when changing anything), when you can just link to `04_install.sh` which has the versions used and pip invocations to install them. ACKs for top commit: practicalswift: cr ACK a46f71b Tree-SHA512: 2900dea3901d03a846dc1ea912f217d152e803845516c7d941745ec1291d145590cd4bf2ddc497f7cf628119ba9905d7b1531836062aa85b384e39cf436f62c6
2 parents feedb9c + a46f71b commit 3bf40d0

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

ci/lint/04_install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ update-alternatives --install /usr/bin/clang-format-diff clang-format-diff $(whi
1313

1414
${CI_RETRY_EXE} pip3 install codespell==2.0.0
1515
${CI_RETRY_EXE} pip3 install flake8==3.8.3
16-
${CI_RETRY_EXE} pip3 install mypy==0.781
16+
${CI_RETRY_EXE} pip3 install mypy==0.910
17+
${CI_RETRY_EXE} pip3 install pyzmq==22.3.0
1718
${CI_RETRY_EXE} pip3 install vulture==2.3
1819

1920
SHELLCHECK_VERSION=v0.7.2

contrib/devtools/security-check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import sys
1111
from typing import List
1212

13-
import lief
13+
import lief #type:ignore
1414

1515
def check_ELF_RELRO(binary) -> bool:
1616
'''

contrib/devtools/symbol-check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import sys
1414
from typing import List, Dict
1515

16-
import lief
16+
import lief #type:ignore
1717

1818
# temporary constant, to be replaced with lief.ELF.ARCH.RISCV
1919
# https://github.com/lief-project/LIEF/pull/562

test/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,15 @@ Use the `-v` option for verbose output.
275275

276276
#### Dependencies
277277

278-
| Lint test | Dependency | Version [used by CI](../ci/lint/04_install.sh) | Installation
279-
|-----------|:----------:|:-------------------------------------------:|--------------
280-
| [`lint-python.sh`](lint/lint-python.sh) | [flake8](https://gitlab.com/pycqa/flake8) | [3.8.3](https://github.com/bitcoin/bitcoin/pull/19348) | `pip3 install flake8==3.8.3`
281-
| [`lint-python.sh`](lint/lint-python.sh) | [mypy](https://github.com/python/mypy) | [0.781](https://github.com/bitcoin/bitcoin/pull/19348) | `pip3 install mypy==0.781`
282-
| [`lint-shell.sh`](lint/lint-shell.sh) | [ShellCheck](https://github.com/koalaman/shellcheck) | [0.7.2](https://github.com/bitcoin/bitcoin/pull/21749) | [details...](https://github.com/koalaman/shellcheck#installing)
283-
| [`lint-spelling.sh`](lint/lint-spelling.sh) | [codespell](https://github.com/codespell-project/codespell) | [2.0.0](https://github.com/bitcoin/bitcoin/pull/20817) | `pip3 install codespell==2.0.0`
278+
| Lint test | Dependency |
279+
|-----------|:----------:|
280+
| [`lint-python.sh`](lint/lint-python.sh) | [flake8](https://gitlab.com/pycqa/flake8)
281+
| [`lint-python.sh`](lint/lint-python.sh) | [mypy](https://github.com/python/mypy)
282+
| [`lint-python.sh`](lint/lint-python.sh) | [pyzmq](https://github.com/zeromq/pyzmq)
283+
| [`lint-shell.sh`](lint/lint-shell.sh) | [ShellCheck](https://github.com/koalaman/shellcheck)
284+
| [`lint-spelling.sh`](lint/lint-spelling.sh) | [codespell](https://github.com/codespell-project/codespell)
285+
286+
In use versions and install instructions are available in the [CI setup](../ci/lint/04_install.sh).
284287

285288
Please be aware that on Linux distributions all dependencies are usually available as packages, but could be outdated.
286289

test/functional/combine_logs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def print_logs_plain(log_events, colors):
188188
def print_logs_html(log_events):
189189
"""Renders the iterator of log events into html."""
190190
try:
191-
import jinja2
191+
import jinja2 #type:ignore
192192
except ImportError:
193193
print("jinja2 not found. Try `pip install jinja2`")
194194
sys.exit(1)

test/functional/data/__init__.py

Whitespace-only changes.

test/functional/test_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
CROSS = "x "
4141
CIRCLE = "o "
4242

43-
if os.name != 'nt' or sys.getwindowsversion() >= (10, 0, 14393):
43+
if os.name != 'nt' or sys.getwindowsversion() >= (10, 0, 14393): #type:ignore
4444
if os.name == 'nt':
4545
import ctypes
4646
kernel32 = ctypes.windll.kernel32 # type: ignore

test/lint/lint-python.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ if ! PYTHONWARNINGS="ignore" flake8 --ignore=B,C,E,F,I,N,W --select=$(IFS=","; e
102102
EXIT_CODE=1
103103
fi
104104

105-
if ! mypy --ignore-missing-imports --show-error-codes $(git ls-files "test/functional/*.py" "contrib/devtools/*.py"); then
105+
if ! mypy --show-error-codes $(git ls-files "test/functional/*.py" "contrib/devtools/*.py"); then
106106
EXIT_CODE=1
107107
fi
108108

0 commit comments

Comments
 (0)