Skip to content

Commit

Permalink
tools: Configure mypy (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau authored Jan 26, 2023
1 parent f676cdc commit 229ee11
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,30 @@ pythonPlatform = "Linux"
venvPath = ".tox"
venv = "py38"

[tool.mypy]
python_version = "3.8"
packages = ["starcraft"]
exclude = [
"build"
]
warn_unused_configs = true
warn_redundant_casts = true
strict_equality = true
strict_concatenate = true
warn_return_any = true
disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_any_generics = true

[[tool.mypy.overrides]]
module = ["starcraft"]
disallow_untyped_defs = true
no_implicit_optional = true

[[tool.mypy.overrides]]
module = ["tests.*"]
strict = false

[tool.ruff]
line-length = 88
target-version = "py38"
Expand Down
7 changes: 6 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,33 @@ deps =
ruff>=0.0.226
# renovate: datasource=pypi
codespell[tomli]>=2.2.2
# renovate: datasource=pypi
mypy[reports]>=0.991
env_dir = {work_dir}/linting
runner = ignore_env_name_mismatch

[shellcheck]
find = find {tox_root} \( -name .git -o -name .tox \) -prune -o -print
filter = file --mime-type -Nnf- | grep shellscript | cut -f1 -d:

[testenv:lint-{black,ruff,pyright,shellcheck,codespell}]
[testenv:lint-{black,ruff,pyright,shellcheck,codespell,mypy}]
description = Lint the source code
base = testenv, lint
labels = lint
allowlist_externals =
pyright: pyright
shellcheck: bash, xargs
mypy: mkdir
commands_pre =
mypy: mkdir -p .mypy_cache
shellcheck: bash -c '{[shellcheck]find} | {[shellcheck]filter} > {env_tmp_dir}/shellcheck_files'
commands =
black: black --check --diff {tty:--color} {posargs} .
ruff: ruff --diff --respect-gitignore {posargs} .
pyright: pyright --lib {posargs}
shellcheck: xargs -ra {env_tmp_dir}/shellcheck_files shellcheck
codespell: codespell --toml {tox_root}/pyproject.toml {posargs}
mypy: mypy --install-types --non-interactive .

[testenv:format-{black,ruff,codespell}]
description = Automatically format source code
Expand Down

0 comments on commit 229ee11

Please sign in to comment.