Add mypy to GitLab CI
This commit is contained in:
parent
552dfd7937
commit
f495b1d079
3 changed files with 40 additions and 1 deletions
|
@ -1,6 +1,14 @@
|
||||||
image: python:3.8-bullseye
|
image: python:3.8-bullseye
|
||||||
|
|
||||||
test:
|
test:mypy:
|
||||||
|
script:
|
||||||
|
- cp config.yaml.example config.yaml
|
||||||
|
- apt update && apt install build-essential
|
||||||
|
- pip install -r requirements.txt --quiet
|
||||||
|
- pip install -r requirements-types.txt --quiet
|
||||||
|
- mypy app
|
||||||
|
|
||||||
|
test:docs:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- cp config.yaml.example config.yaml
|
- cp config.yaml.example config.yaml
|
||||||
|
|
27
mypy.ini
Normal file
27
mypy.ini
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
[mypy]
|
||||||
|
; Ensure full coverage
|
||||||
|
disallow_untyped_calls = True
|
||||||
|
disallow_untyped_defs = True
|
||||||
|
disallow_incomplete_defs = True
|
||||||
|
disallow_untyped_decorators = True
|
||||||
|
check_untyped_defs = True
|
||||||
|
|
||||||
|
; Restrict dynamic typing
|
||||||
|
disallow_any_generics = True
|
||||||
|
disallow_subclassing_any = True
|
||||||
|
warn_return_any = True
|
||||||
|
|
||||||
|
; Know exactly what you're doing
|
||||||
|
warn_redundant_casts = True
|
||||||
|
warn_unused_ignores = True
|
||||||
|
warn_unused_configs = True
|
||||||
|
warn_unreachable = True
|
||||||
|
show_error_codes = True
|
||||||
|
|
||||||
|
; Explicit is better than implicit
|
||||||
|
no_implicit_optional = True
|
||||||
|
|
||||||
|
; Some libraries don't have hints yet
|
||||||
|
ignore_missing_imports = True
|
||||||
|
follow_imports = silent
|
||||||
|
|
4
requirements-types.txt
Normal file
4
requirements-types.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
mypy
|
||||||
|
types-requests
|
||||||
|
types-PyYAML
|
||||||
|
types-python-dateutil
|
Loading…
Add table
Add a link
Reference in a new issue