1
1
minimum_pre_commit_version : 2.9.2
2
2
exclude : ^LICENSES/|\.(html|csv|svg)$
3
3
repos :
4
+ - repo : https://github.com/MarcoGorelli/absolufy-imports
5
+ rev : v0.2.1
6
+ hooks :
7
+ - id : absolufy-imports
8
+ files : ^pandas/
4
9
- repo : https://github.com/python/black
5
10
rev : 20.8b1
6
11
hooks :
7
12
- id : black
13
+ - repo : https://github.com/codespell-project/codespell
14
+ rev : v2.0.0
15
+ hooks :
16
+ - id : codespell
17
+ types_or : [python, rst, markdown]
18
+ files : ^pandas/
19
+ exclude : ^pandas/tests/
20
+ - repo : https://github.com/pre-commit/pre-commit-hooks
21
+ rev : v3.4.0
22
+ hooks :
23
+ - id : end-of-file-fixer
24
+ exclude : \.txt$
25
+ - id : trailing-whitespace
8
26
- repo : https://gitlab.com/pycqa/flake8
9
27
rev : 3.8.4
10
28
hooks :
@@ -23,6 +41,10 @@ repos:
23
41
rev : 5.7.0
24
42
hooks :
25
43
- id : isort
44
+ - repo : https://github.com/MarcoGorelli/no-string-hints
45
+ rev : v0.1.7
46
+ hooks :
47
+ - id : no-string-hints
26
48
- repo : https://github.com/asottile/pyupgrade
27
49
rev : v2.10.0
28
50
hooks :
@@ -38,16 +60,12 @@ repos:
38
60
- id : rst-inline-touching-normal
39
61
types : [text] # overwrite types: [rst]
40
62
types_or : [python, rst]
63
+ - repo : https://github.com/asottile/yesqa
64
+ rev : v1.2.2
65
+ hooks :
66
+ - id : yesqa
41
67
- repo : local
42
68
hooks :
43
- - id : pip_to_conda
44
- name : Generate pip dependency from conda
45
- description : This hook checks if the conda environment.yml and requirements-dev.txt are equal
46
- language : python
47
- entry : python scripts/generate_pip_deps_from_conda.py
48
- files : ^(environment.yml|requirements-dev.txt)$
49
- pass_filenames : false
50
- additional_dependencies : [pyyaml]
51
69
- id : flake8-rst
52
70
name : flake8-rst
53
71
description : Run flake8 on code snippets in docstrings or RST files
@@ -56,6 +74,40 @@ repos:
56
74
types : [rst]
57
75
args : [--filename=*.rst]
58
76
additional_dependencies : [flake8-rst==0.7.0, flake8==3.7.9]
77
+ - id : frame-or-series-union
78
+ name : Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
79
+ entry : Union\[.*(Series,.*DataFrame|DataFrame,.*Series).*\]
80
+ language : pygrep
81
+ types : [python]
82
+ exclude : ^pandas/_typing\.py$
83
+ - id : inconsistent-namespace-usage
84
+ name : ' Check for inconsistent use of pandas namespace in tests'
85
+ entry : python scripts/check_for_inconsistent_pandas_namespace.py
86
+ language : python
87
+ types : [python]
88
+ files : ^pandas/tests/frame/
89
+ - id : incorrect-code-directives
90
+ name : Check for incorrect code block or IPython directives
91
+ language : pygrep
92
+ entry : (\.\. code-block ::|\.\. ipython ::)
93
+ types_or : [python, cython, rst]
94
+ - id : no-os-remove
95
+ name : Check code for instances of os.remove
96
+ entry : os\.remove
97
+ language : pygrep
98
+ types : [python]
99
+ files : ^pandas/tests/
100
+ exclude : |
101
+ (?x)^
102
+ pandas/tests/io/excel/test_writers\.py
103
+ |pandas/tests/io/pytables/common\.py
104
+ |pandas/tests/io/pytables/test_store\.py$
105
+ - id : no-pandas-api-types
106
+ name : Check code for instances of pd.api.types
107
+ entry : (pd|pandas)\.api\.types\.
108
+ language : pygrep
109
+ types : [python]
110
+ files : ^pandas/tests/
59
111
- id : non-standard-imports
60
112
name : Check for non-standard imports
61
113
language : pygrep
@@ -67,17 +119,6 @@ repos:
67
119
68
120
# Check for imports from collections.abc instead of `from collections import abc`
69
121
|from\ collections\.abc\ import
70
-
71
- - id : non-standard-numpy.random-related-imports
72
- name : Check for non-standard numpy.random-related imports excluding pandas/_testing.py
73
- language : pygrep
74
- exclude : pandas/_testing.py
75
- entry : |
76
- (?x)
77
- # Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
78
- from\ numpy\ import\ random
79
- |from\ numpy.random\ import
80
- types : [python]
81
122
- id : non-standard-imports-in-tests
82
123
name : Check for non-standard imports in test suite
83
124
language : pygrep
@@ -95,62 +136,79 @@ repos:
95
136
|pd\.testing\.
96
137
types : [python]
97
138
files : ^pandas/tests/
98
- - id : incorrect-code-directives
99
- name : Check for incorrect code block or IPython directives
139
+ - id : non-standard-numpy-random-related-imports
140
+ name : Check for non-standard numpy.random-related imports excluding pandas/_testing.py
141
+ language : pygrep
142
+ exclude : pandas/_testing.py
143
+ entry : |
144
+ (?x)
145
+ # Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
146
+ from\ numpy\ import\ random
147
+ |from\ numpy.random\ import
148
+ types : [python]
149
+ - id : np-bool
150
+ name : Check for use of np.bool instead of np.bool_
151
+ entry : np\.bool[^_8]
100
152
language : pygrep
101
- entry : (\.\. code-block ::|\.\. ipython ::)
102
153
types_or : [python, cython, rst]
103
- - id : unwanted-patterns-strings-to-concatenate
104
- name : Check for use of not concatenated strings
154
+ - id : np-object
155
+ name : Check for use of np.object instead of np.object_
156
+ entry : np\.object[^_8]
157
+ language : pygrep
158
+ types_or : [python, cython, rst]
159
+ - id : pip-to-conda
160
+ name : Generate pip dependency from conda
161
+ description : This hook checks if the conda environment.yml and requirements-dev.txt are equal
105
162
language : python
106
- entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
107
- types_or : [python, cython]
108
- - id : unwanted-patterns-strings-with-wrong-placed-whitespace
109
- name : Check for strings with wrong placed spaces
163
+ entry : python scripts/generate_pip_deps_from_conda.py
164
+ files : ^(environment.yml|requirements-dev.txt)$
165
+ pass_filenames : false
166
+ additional_dependencies : [pyyaml]
167
+ - id : title-capitalization
168
+ name : Validate correct capitalization among titles in documentation
169
+ entry : python scripts/validate_rst_title_capitalization.py
110
170
language : python
111
- entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
171
+ types : [rst]
172
+ files : ^doc/source/(development|reference)/
173
+ - id : type-not-class
174
+ name : Check for use of foo.__class__ instead of type(foo)
175
+ entry : \.__class__
176
+ language : pygrep
112
177
types_or : [python, cython]
113
- - id : unwanted-patterns-private-import-across-module
114
- name : Check for import of private attributes across modules
178
+ - id : unwanted-patterns-bare-pytest-raises
179
+ name : Check for use of bare pytest raises
115
180
language : python
116
- entry : python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module "
181
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises "
117
182
types : [python]
118
- exclude : ^(asv_bench|pandas/tests|doc)/
183
+ files : ^pandas/tests/
184
+ exclude : ^pandas/tests/extension/
119
185
- id : unwanted-patterns-private-function-across-module
120
186
name : Check for use of private functions across modules
121
187
language : python
122
188
entry : python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
123
189
types : [python]
124
190
exclude : ^(asv_bench|pandas/tests|doc)/
125
- - id : unwanted-patterns-bare-pytest-raises
126
- name : Check for use of bare pytest raises
191
+ - id : unwanted-patterns-private-import-across-module
192
+ name : Check for import of private attributes across modules
127
193
language : python
128
- entry : python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises "
194
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module "
129
195
types : [python]
130
- files : ^pandas/tests/
131
- exclude : ^pandas/tests/extension/
132
- - id : unwanted-patters-pytest-xfail
196
+ exclude : ^(asv_bench|pandas/tests|doc)/
197
+ - id : unwanted-patterns-pytest-xfail
133
198
name : Check for use of pytest.xfail
134
199
entry : pytest\.xfail
135
200
language : pygrep
136
201
types : [python]
137
202
files : ^pandas/tests/
138
- - id : inconsistent-namespace-usage
139
- name : ' Check for inconsistent use of pandas namespace in tests'
140
- entry : python scripts/check_for_inconsistent_pandas_namespace.py
203
+ - id : unwanted-patterns-strings-to-concatenate
204
+ name : Check for use of not concatenated strings
141
205
language : python
142
- types : [python]
143
- files : ^pandas/tests/frame/
144
- - id : FrameOrSeriesUnion
145
- name : Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
146
- entry : Union\[.*(Series,.*DataFrame|DataFrame,.*Series).*\]
147
- language : pygrep
148
- types : [python]
149
- exclude : ^pandas/_typing\.py$
150
- - id : type-not-class
151
- name : Check for use of foo.__class__ instead of type(foo)
152
- entry : \.__class__
153
- language : pygrep
206
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
207
+ types_or : [python, cython]
208
+ - id : unwanted-patterns-strings-with-wrong-placed-whitespace
209
+ name : Check for strings with wrong placed spaces
210
+ language : python
211
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
154
212
types_or : [python, cython]
155
213
- id : unwanted-typing
156
214
name : Check for outdated annotation syntax and missing error codes
@@ -160,62 +218,3 @@ repos:
160
218
|\#\ type:\s?ignore(?!\[)
161
219
language : pygrep
162
220
types : [python]
163
- - id : np-bool
164
- name : Check for use of np.bool instead of np.bool_
165
- entry : np\.bool[^_8]
166
- language : pygrep
167
- types_or : [python, cython, rst]
168
- - id : np-object
169
- name : Check for use of np.object instead of np.object_
170
- entry : np\.object[^_8]
171
- language : pygrep
172
- types_or : [python, cython, rst]
173
- - id : no-os-remove
174
- name : Check code for instances of os.remove
175
- entry : os\.remove
176
- language : pygrep
177
- types : [python]
178
- files : ^pandas/tests/
179
- exclude : |
180
- (?x)^
181
- pandas/tests/io/excel/test_writers\.py
182
- |pandas/tests/io/pytables/common\.py
183
- |pandas/tests/io/pytables/test_store\.py$
184
- - id : no-pandas-api-types
185
- name : Check code for instances of pd.api.types
186
- entry : (pd|pandas)\.api\.types\.
187
- language : pygrep
188
- types : [python]
189
- files : ^pandas/tests/
190
- - id : title-capitalization
191
- name : Validate correct capitalization among titles in documentation
192
- entry : python scripts/validate_rst_title_capitalization.py
193
- language : python
194
- types : [rst]
195
- files : ^doc/source/(development|reference)/
196
- - repo : https://github.com/asottile/yesqa
197
- rev : v1.2.2
198
- hooks :
199
- - id : yesqa
200
- - repo : https://github.com/pre-commit/pre-commit-hooks
201
- rev : v3.4.0
202
- hooks :
203
- - id : end-of-file-fixer
204
- exclude : \.txt$
205
- - id : trailing-whitespace
206
- - repo : https://github.com/codespell-project/codespell
207
- rev : v2.0.0
208
- hooks :
209
- - id : codespell
210
- types_or : [python, rst, markdown]
211
- files : ^pandas/
212
- exclude : ^pandas/tests/
213
- - repo : https://github.com/MarcoGorelli/no-string-hints
214
- rev : v0.1.7
215
- hooks :
216
- - id : no-string-hints
217
- - repo : https://github.com/MarcoGorelli/absolufy-imports
218
- rev : v0.2.1
219
- hooks :
220
- - id : absolufy-imports
221
- files : ^pandas/
0 commit comments