A collection of fast, cheap, regex based pre-commit hooks.
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0 # Use the ref you want to point at
hooks:
- id: python-use-type-annotations
# ...
Where possible, these hooks will be prefixed with the file types they target.
For example, a hook which targets python will be called python-...
.
python-check-blanket-noqa
: Enforce thatnoqa
annotations always occur with specific codes. Sample annotations:# noqa: F401
,# noqa: F401,W203
python-check-blanket-type-ignore
: Enforce that# type: ignore
annotations always occur with specific codes. Sample annotations:# type: ignore[attr-defined]
,# type: ignore[attr-defined, name-defined]
python-check-mock-methods
: Prevent common mistakes ofassert mck.not_called()
,assert mck.called_once_with(...)
andmck.assert_called
.python-no-eval
: A quick check for theeval()
built-in functionpython-no-log-warn
: A quick check for the deprecated.warn()
method of python loggerspython-use-type-annotations
: Enforce that python3.6+ type annotations are used instead of type commentsrst-backticks
: Detect common mistake of using single backticks when writing rstrst-directive-colons
: Detect mistake of rst directive not ending with double colon or space before the double colonrst-inline-touching-normal
: Detect mistake of inline code touching normal text in rsttext-unicode-replacement-char
: Forbid files which have a UTF-8 Unicode replacement character