Skip to content

Commit af45b0a

Browse files
authored
STYLE: use types_or in pre-commit (#38457)
1 parent dc4eaf3 commit af45b0a

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

.pre-commit-config.yaml

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
minimum_pre_commit_version: '2.9.2'
12
repos:
23
- repo: https://github.com/python/black
34
rev: 20.8b1
@@ -21,10 +22,8 @@ repos:
2122
rev: 5.6.4
2223
hooks:
2324
- id: isort
24-
name: isort (python)
25-
- id: isort
26-
name: isort (cython)
27-
types: [cython]
25+
types: [text] # overwrite upstream `types: [python]`
26+
types_or: [python, cython]
2827
- repo: https://github.com/asottile/pyupgrade
2928
rev: v2.7.4
3029
hooks:
@@ -96,17 +95,17 @@ repos:
9695
name: Check for incorrect code block or IPython directives
9796
language: pygrep
9897
entry: (\.\. code-block ::|\.\. ipython ::)
99-
files: \.(py|pyx|rst)$
98+
types_or: [python, cython, rst]
10099
- id: unwanted-patterns-strings-to-concatenate
101100
name: Check for use of not concatenated strings
102101
language: python
103102
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
104-
files: \.(py|pyx|pxd|pxi)$
103+
types_or: [python, cython]
105104
- id: unwanted-patterns-strings-with-wrong-placed-whitespace
106105
name: Check for strings with wrong placed spaces
107106
language: python
108107
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
109-
files: \.(py|pyx|pxd|pxi)$
108+
types_or: [python, cython]
110109
- id: unwanted-patterns-private-import-across-module
111110
name: Check for import of private attributes across modules
112111
language: python

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
- flake8-comprehensions>=3.1.0 # used by flake8, linting of unnecessary comprehensions
2525
- isort>=5.2.1 # check that imports are in the right order
2626
- mypy=0.782
27-
- pre-commit
27+
- pre-commit>=2.9.2
2828
- pycodestyle # used by flake8
2929
- pyupgrade
3030

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ flake8
1212
flake8-comprehensions>=3.1.0
1313
isort>=5.2.1
1414
mypy==0.782
15-
pre-commit
15+
pre-commit>=2.9.2
1616
pycodestyle
1717
pyupgrade
1818
gitpython

0 commit comments

Comments
 (0)