Skip to content
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

[TEST] Enforce type hints with MyPy #37

Closed
jeertmans opened this issue Oct 5, 2022 · 2 comments · Fixed by #41
Closed

[TEST] Enforce type hints with MyPy #37

jeertmans opened this issue Oct 5, 2022 · 2 comments · Fixed by #41
Assignees
Labels
ci Continous Integration (tests, lints, checks, ...) good first issue Good for newcomers hacktoberfest Issue that is created for the Hacktoberfest event

Comments

@jeertmans
Copy link
Owner

What

In par with #34, I'd like to have some checks to assert that all functions, methods, and constants have type hints.

How to

This PR requires adding a pre-commit hook that using mypy. After the flake8 hook:

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-tidy-imports
- flake8-typing-imports

you need to add:

-   repo: https://github.com/pre-commit/mirrors-mypy
    rev: ''  # Use the sha / tag you want to point at
    hooks:
    -   id: mypy

and use customized arguments to make sure it only checks for type hints.

Useful links

@jeertmans jeertmans added good first issue Good for newcomers hacktoberfest Issue that is created for the Hacktoberfest event labels Oct 5, 2022
@elliotwutingfeng
Copy link
Contributor

Let me try this

@jeertmans
Copy link
Owner Author

Hi @elliotwutingfeng! Sure, go on ;-)
Do not hesitate to ask questions if you have any!

@jeertmans jeertmans linked a pull request Oct 11, 2022 that will close this issue
@jeertmans jeertmans added the ci Continous Integration (tests, lints, checks, ...) label Apr 4, 2024
@jeertmans jeertmans changed the title chore(ci): enforce type hints with MyPy [TEST] Enforce type hints with MyPy Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continous Integration (tests, lints, checks, ...) good first issue Good for newcomers hacktoberfest Issue that is created for the Hacktoberfest event
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants