Skip to content

Commit

Permalink
Add mypy to the project
Browse files Browse the repository at this point in the history
  • Loading branch information
OmeGak committed Sep 19, 2023
1 parent ffc725d commit d184646
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .github/matchers/mypy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"problemMatcher": [
{
"owner": "mypy",
"pattern": [
{
"regexp": "^([^:]+):(\\d+): error: (.+)$",
"file": 1,
"line": 2,
"message": 3
}
]
}
]
}
7 changes: 4 additions & 3 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
- devel
- master

env:
NO_COLORS: true

jobs:
setup:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -49,9 +46,13 @@ jobs:
run: |
poetry install
- name: Run tests
env:
NO_COLORS: true
run: |
echo "::add-matcher::.github/matchers/mypy.json"
echo "::add-matcher::.github/matchers/ruff.json"
echo "::add-matcher::.github/matchers/unbehead.json"
poetry run -- make lint --keep-going
echo "::remove-matcher owner=unbehead::"
echo "::remove-matcher owner=ruff::"
echo "::remove-matcher owner=mypy::"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
dist/

# temporary directories
.mypy_cache/
.pytest_cache/
.ruff_cache/
__pycache__/
2 changes: 2 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mypy]
exclude = tests/
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# -- linting -------------------------------------------------------------------

.PHONY: mypy
mypy:
# FIXME: Remove flag once it's possible to disable color via envvar.
# The uncolored output is necessary on CI for the matcher to work.
mypy . --no-color-output

.PHONY: ruff
ruff:
ruff check .
Expand All @@ -9,7 +15,7 @@ unbehead:
unbehead --check

.PHONY: lint
lint: ruff unbehead
lint: mypy ruff unbehead

# -- testing -------------------------------------------------------------------

Expand Down
81 changes: 80 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ pyyaml = ">=6"
click = ">=8"

[tool.poetry.group.dev.dependencies]
mypy = "^1.5.1"
pytest = "^7.4.0"
ruff = "^0.0.280"
types-pyyaml = "^6.0.12.11"

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit d184646

Please sign in to comment.