Skip to content

Commit

Permalink
Reorder mypy and pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
mepland committed Jun 2, 2024
1 parent 371c82b commit b3f0d0c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ jobs:
echo "::endgroup::"
poetry run flake8 --format github ${{ steps.filter.outputs.python_files }}
- name: mypy
if: (success() || failure()) && steps.filter.outputs.python == 'true'
run: poetry run mypy ${{ steps.filter.outputs.python_files }}

- name: pylint
if: (success() || failure()) && steps.filter.outputs.python_alone == 'true'
run: poetry run pylint ${{ steps.filter.outputs.python_alone_files }}

- name: mypy
if: (success() || failure()) && steps.filter.outputs.python == 'true'
run: poetry run mypy ${{ steps.filter.outputs.python_files }}

- name: bandit
if: (success() || failure()) && steps.filter.outputs.python == 'true'
run: poetry run bandit -r ${{ steps.filter.outputs.python_files }}
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@ repos:
tryceratops
]

# mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.10.0'
hooks:
- id: mypy

# pylint
# https://pylint.readthedocs.io/en/latest/user_guide/installation/pre-commit-integration.html#pre-commit-integration
- repo: local
Expand All @@ -116,6 +110,12 @@ repos:
language: system
types: [python]

# mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.10.0'
hooks:
- id: mypy

# bandit
- repo: https://github.com/PyCQA/bandit
rev: '1.7.8'
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ ruff-fix:
ruff-fix-unsafe:
@poetry run ruff check --fix-only --unsafe-fixes

.PHONY: mypy
mypy:
@poetry run mypy .

# https://stackoverflow.com/a/63044665
.PHONY: pylint
pylint:
@poetry run pylint $(shell git ls-files '*.py' '*.ipynb')

.PHONY: mypy
mypy:
@poetry run mypy .

.PHONY: bandit
bandit:
@poetry run bandit -q -r .
Expand Down
42 changes: 21 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ black = { extras = ["jupyter"], version = "^24.4.2" }
blacken-docs = "^1.16.0"
flake8 = "^7.0.0"
ruff = "^0.4.3"
mypy = "^1.10.0"
pylint = "^3.1.0"
mypy = "^1.10.0"
bandit = "^1.7.7"
vulture = "^2.11"
pymend = { git = "https://github.com/JanEricNitschke/pymend.git" }
Expand Down Expand Up @@ -282,26 +282,6 @@ max-locals = 30
max-statements = 100
max-nested-blocks = 6

[tool.mypy]
python_version = "3.11"
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disable_error_code = ["import"]
# warn_unused_ignores = true is useful when upgrading mypy versions,
# but leaving it as true all the time gives false positives when running mypy in the pre-commit env
warn_unused_ignores = false
exclude = [
".cache",
".direnv",
".env",
".git",
".github",
".ipynb_checkpoints",
".venv",
"__pycache__",
]

[tool.pylint.main]
fail-under = 10
fail-on = "I"
Expand Down Expand Up @@ -355,6 +335,26 @@ module-naming-style = "snake_case"
variable-naming-style = "snake_case"
good-names = ["i", "j", "k", "ex", "Run", "_", "x", "y", "ax", "v", "n"]

[tool.mypy]
python_version = "3.11"
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disable_error_code = ["import"]
# warn_unused_ignores = true is useful when upgrading mypy versions,
# but leaving it as true all the time gives false positives when running mypy in the pre-commit env
warn_unused_ignores = false
exclude = [
".cache",
".direnv",
".env",
".git",
".github",
".ipynb_checkpoints",
".venv",
"__pycache__",
]

[tool.vulture]
paths = ["."]
exclude = [
Expand Down

0 comments on commit b3f0d0c

Please sign in to comment.