fonttools / fontbakery

🧁 A font quality assurance tool for everyone
https://fontbakery.readthedocs.io
Apache License 2.0
546 stars 99 forks source link

Type checking #1824

Open madig opened 6 years ago

madig commented 6 years ago

Python 3 introduced optional type hints: http://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html

It is indirectly possible to use these in Python 2 and have mypy check them by using comments: http://mypy.readthedocs.io/en/latest/python2.html https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code

This would be an additional linting layer.

madig commented 5 years ago

Here's a nice recent video about it: https://www.youtube.com/watch?v=pMgmKJyWKn8

Gradually introducing types is probably the best option. I'm sure there's a way to only run mypy on code that is being merged in a PR, to remind people to annotate their code.