Skip to content

Commit

Permalink
add mypy and update pre-commit checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ModischFabrications committed Apr 2, 2024
1 parent 0e70c8f commit a73bf1e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ jobs:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
pipenv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with mypy 🔍
run: |
# stop the build if there are typing errors
pipenv run python -m mypy .
- name: Test with pytest 🔍
run: |
# stop the build if there are failed tests
pipenv run python -m pytest --durations=10
build-and-push-docker:
Expand Down
20 changes: 14 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
rev: v4.5.0
hooks:
# https://blog.mphomphego.co.za/blog/2019/10/03/Why-you-need-to-stop-using-Git-Hooks.html
- id: check-ast
Expand Down Expand Up @@ -49,8 +49,16 @@ repos:
- id: requirements-txt-fixer
name: requirements-txt-fixer
description: Sorts entries in requirements.txt
- id: check-json
name: check-json
description: Attempts to load all json files to verify syntax.

#bandit, vulture?
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
name: mypy
description: Check typing

- repo: local
hooks:
Expand All @@ -63,9 +71,9 @@ repos:
language: system
# git version check only needed if version could have changed
files: main.py
types: [python]
types: [ python ]
# TODO: use post-commit
stages: [push]
stages: [ push ]

- id: tests
name: run tests
Expand All @@ -74,5 +82,5 @@ repos:
pass_filenames: false
entry: pipenv run python -m pytest -sv
language: system
types: [python]
stages: [push]
types: [ python ]
stages: [ push ]

0 comments on commit a73bf1e

Please sign in to comment.