Add mypy to GitLab CI

This commit is contained in:
Iain Learmonth 2022-05-15 16:56:31 +00:00 committed by Iain Learmonth
parent 552dfd7937
commit f495b1d079
3 changed files with 40 additions and 1 deletions

View file

@ -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
View 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
View file

@ -0,0 +1,4 @@
mypy
types-requests
types-PyYAML
types-python-dateutil