Skip to content

Commit e460678

Browse files
add pygrep hooks (#141)
Co-authored-by: Bill Little <bill.little@metoffice.gov.uk>
1 parent 750efec commit e460678

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

.pre-commit-config.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,29 @@ repos:
102102
hooks:
103103
- id: numpydoc-validation
104104
types: [file, python]
105-
exclude: 'src\/mo_pack\/tests'
105+
exclude: 'src\/mo_pack\/tests'
106+
107+
- repo: https://github.com/pre-commit/pygrep-hooks
108+
rev: v1.10.0
109+
hooks:
110+
- id: python-check-blanket-noqa
111+
# Enforce that all noqa annotations always occur with specific codes.
112+
- id: python-check-blanket-type-ignore
113+
# Enforce that "# type: ignore" annotations always occur with specific codes.
114+
- id: python-check-mock-methods
115+
# Prevent common mistakes of assert mck.not_called(), assert
116+
# mck.called_once_with(...) and mck.assert_called.
117+
- id: python-no-eval
118+
# A quick check for the eval() built-in function
119+
- id: python-no-log-warn
120+
# A quick check for the deprecated .warn() method of python loggers
121+
- id: python-use-type-annotations
122+
# Enforce that python3.6+ type annotations are used instead of type comments
123+
- id: rst-backticks
124+
# Detect common mistake of using single backticks when writing rst.
125+
- id: rst-directive-colons
126+
# Detect mistake of rst directive not ending with double colon.
127+
- id: rst-inline-touching-normal
128+
# Detect mistake of inline code touching normal text in rst.
129+
- id: text-unicode-replacement-char
130+
# Forbid files which have a UTF-8 Unicode replacement character.

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ exclude = [
123123

124124
[tool.repo-review]
125125
ignore = [
126-
# https://learn.scientific-python.org/development/guides/style/#PC170
127-
"PC170", # Uses PyGrep hooks
128126
# https://learn.scientific-python.org/development/guides/style/#PC180
129127
"PC180", # Uses prettier
130128
# https://learn.scientific-python.org/development/guides/packaging-simple/#PY004

0 commit comments

Comments
 (0)