Skip to content

Commit 488eea1

Browse files
committed
Full on mypy testing
1 parent 02c893f commit 488eea1

28 files changed

+985
-457
lines changed

.pre-commit-config.yaml

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
# Copyright 2022 VMware, Inc.
2-
# SPDX-License-Identifier: Apache-2
3-
41
default_language_version:
5-
python: python3
6-
2+
python: python3
73
repos:
8-
# ----- Local Hooks ----------------------------------------------------------------------------------------------->
9-
- repo: local
10-
hooks:
11-
- id: check-changelog-entries
12-
name: Check Changelog Entries
13-
entry: python .pre-commit-hooks/check_changelog_entries.py
14-
language: system
15-
16-
- repo: local
17-
hooks:
18-
- id: check-copyright-headers
19-
name: Check python modules for appropriate copyright headers
20-
files: ^.*\.py$
21-
exclude: setup\.py
22-
entry: python .pre-commit-hooks/copyright_headers.py
23-
language: system
24-
# <---- Local Hooks ------------------------------------------------------------------------------------------------
25-
26-
- repo: https://github.com/timothycrosley/isort
27-
rev: 5.12.0
28-
hooks:
29-
- id: isort
30-
31-
- repo: https://github.com/psf/black
32-
rev: 22.6.0
33-
hooks:
34-
- id: black
35-
36-
# ----- Code Analysis --------------------------------------------------------------------------------------------->
37-
- repo: https://github.com/pycqa/flake8
38-
rev: '5.0.4'
39-
hooks:
40-
- id: flake8
41-
exclude: ^(\.pre-commit-hooks/.*\.py)$
42-
additional_dependencies:
43-
- flake8-mypy-fork
44-
- flake8-docstrings
45-
- flake8-typing-imports
46-
# <---- Code Analysis ---------------------------------------------------------------------------------------------
4+
- repo: local
5+
hooks:
6+
- id: check-changelog-entries
7+
name: Check Changelog Entries
8+
entry: python .pre-commit-hooks/check_changelog_entries.py
9+
language: system
10+
- repo: local
11+
hooks:
12+
- id: check-copyright-headers
13+
name: Check python modules for appropriate copyright headers
14+
files: ^.*\.py$
15+
exclude: setup\.py
16+
entry: python .pre-commit-hooks/copyright_headers.py
17+
language: system
18+
- repo: https://github.com/timothycrosley/isort
19+
rev: 5.12.0
20+
hooks:
21+
- id: isort
22+
- repo: https://github.com/psf/black
23+
rev: 22.6.0
24+
hooks:
25+
- id: black
26+
- repo: https://github.com/pycqa/flake8
27+
rev: 5.0.4
28+
hooks:
29+
- id: flake8
30+
exclude: ^(\.pre-commit-hooks/.*\.py)$
31+
additional_dependencies:
32+
- flake8-mypy-fork
33+
- flake8-docstrings
34+
- flake8-typing-imports
35+
- repo: https://github.com/pre-commit/mirrors-mypy
36+
rev: v1.11.1
37+
hooks:
38+
- id: mypy
39+
args:
40+
- --strict
41+
- --config-file=pyproject.toml
42+
- relenv/
43+
- tests/
44+
additional_dependencies:
45+
- types-requests
46+
pass_filenames: false

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,11 @@ ensure_newline_before_comments=true
2121

2222
[tool.pylint]
2323
max-line-length=120
24+
25+
[tool.mypy]
26+
python_version = "3.10"
27+
explicit_package_bases = true
28+
ignore_missing_imports = true
29+
namespace_packages = true
30+
mypy_path = "."
31+
exclude = "relenv/__main__\\.py"

relenv/build/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Copyright 2022-2025 Broadcom.
2-
# SPDX-License-Identifier: Apache-2
2+
# SPDX-License-Identifier: Apache-2.0
3+
# mypy: ignore-errors
34
"""
4-
The ``relenv build`` command.
5+
Entry points for the ``relenv build`` CLI command.
56
"""
67
from __future__ import annotations
78

@@ -10,7 +11,7 @@
1011
import random
1112
import signal
1213
import sys
13-
from types import ModuleType
14+
from types import FrameType, ModuleType
1415

1516
from . import darwin, linux, windows
1617
from .common import CHECK_VERSIONS_SUPPORT, builds
@@ -200,7 +201,7 @@ def main(args: argparse.Namespace) -> None:
200201
else:
201202
show_ui = True
202203

203-
def signal_handler(signal, frame):
204+
def signal_handler(_signal: int, frame: FrameType | None) -> None:
204205
sys.exit(1)
205206

206207
signal.signal(signal.SIGINT, signal_handler)

0 commit comments

Comments
 (0)