-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable mypy in precommit #318
Conversation
hackaugusto
commented
Feb 1, 2022
- Adds mypy to the precommit
- Fixes some typing issues with code that should have been type checked
- Made the configuration for type checking opt-out instead of opt-in (the idea is that code in new modules should be typed by default)
Notes:
|
Do you think it would be worth to add this to CONTRIBUTING.md so people know are aware of this? |
We do mention it, the problem was that mypy was not configured to run with pre-commit. |
Note: to enable mypy for the tests, something like this should be used: # `mypy tests` can't be run because mypy complains about the repeated conftest.py
# https://github.com/python/mypy/issues/4008: current solution is to run mypy separately
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.931
hooks:
- id: mypy
name: Mypy Karapace
pass_filenames: false
args: ["--ignore-missing-imports", "--package", "karapace"]
- id: mypy
name: Mypy integration tests
pass_filenames: false
args: ["--ignore-missing-imports", "tests/integration"]
- id: mypy
name: Mypy unit tests
pass_filenames: false
args: ["--ignore-missing-imports", "tests/unit"] |
007a4b0
to
4da3a8b
Compare
I did a quick look on how to model the JSON Schema using recursive types, but that is just not really feasible now for a few reasons:
|
4da3a8b
to
9ffae90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, apart for one spelling error.
9ffae90
to
6c297e4
Compare