38
38
types_or : [python, rst, markdown]
39
39
additional_dependencies : [tomli]
40
40
- repo : https://github.com/MarcoGorelli/cython-lint
41
- rev : v0.9 .1
41
+ rev : v0.10 .1
42
42
hooks :
43
43
- id : cython-lint
44
44
- id : double-quote-cython-strings
@@ -71,12 +71,12 @@ repos:
71
71
' --filter=-readability/casting,-runtime/int,-build/include_subdir,-readability/fn_size'
72
72
]
73
73
- repo : https://github.com/pycqa/pylint
74
- rev : v2.15.6
74
+ rev : v2.15.9
75
75
hooks :
76
76
- id : pylint
77
77
stages : [manual]
78
78
- repo : https://github.com/pycqa/pylint
79
- rev : v2.15.6
79
+ rev : v2.15.9
80
80
hooks :
81
81
- id : pylint
82
82
alias : redefined-outer-name
@@ -89,15 +89,14 @@ repos:
89
89
|^pandas/util/_test_decorators\.py # keep excluded
90
90
|^pandas/_version\.py # keep excluded
91
91
|^pandas/conftest\.py # keep excluded
92
- |^pandas/core/generic\.py
93
92
args : [--disable=all, --enable=redefined-outer-name]
94
93
stages : [manual]
95
94
- repo : https://github.com/PyCQA/isort
96
- rev : 5.10.1
95
+ rev : 5.11.4
97
96
hooks :
98
97
- id : isort
99
98
- repo : https://github.com/asottile/pyupgrade
100
- rev : v3.2.2
99
+ rev : v3.3.1
101
100
hooks :
102
101
- id : pyupgrade
103
102
args : [--py38-plus]
@@ -172,6 +171,21 @@ repos:
172
171
types : [rst]
173
172
args : [--filename=*.rst]
174
173
additional_dependencies : [flake8-rst==0.7.0, flake8==3.7.9]
174
+ - id : inconsistent-namespace-usage
175
+ name : ' Check for inconsistent use of pandas namespace'
176
+ entry : python scripts/check_for_inconsistent_pandas_namespace.py
177
+ exclude : ^pandas/core/interchange/
178
+ language : python
179
+ types : [python]
180
+ - id : no-os-remove
181
+ name : Check code for instances of os.remove
182
+ entry : os\.remove
183
+ language : pygrep
184
+ types : [python]
185
+ files : ^pandas/tests/
186
+ exclude : |
187
+ (?x)^
188
+ pandas/tests/io/pytables/test_store\.py$
175
189
- id : unwanted-patterns
176
190
name : Unwanted patterns
177
191
language : pygrep
@@ -181,6 +195,20 @@ repos:
181
195
\#\ type:\ (?!ignore)
182
196
|\#\ type:\s?ignore(?!\[)
183
197
198
+ # foo._class__ instead of type(foo)
199
+ |\.__class__
200
+
201
+ # np.bool/np.object instead of np.bool_/np.object_
202
+ |np\.bool[^_8`]
203
+ |np\.object[^_8`]
204
+
205
+ # imports from collections.abc instead of `from collections import abc`
206
+ |from\ collections\.abc\ import
207
+
208
+ # Numpy
209
+ |from\ numpy\ import\ random
210
+ |from\ numpy\.random\ import
211
+
184
212
# Incorrect code-block / IPython directives
185
213
|\.\.\ code-block\ ::
186
214
|\.\.\ ipython\ ::
@@ -189,7 +217,17 @@ repos:
189
217
190
218
# Check for deprecated messages without sphinx directive
191
219
|(DEPRECATED|DEPRECATE|Deprecated)(:|,|\.)
220
+
221
+ # {foo!r} instead of {repr(foo)}
222
+ |!r}
223
+
224
+ # builtin filter function
225
+ |(?<!def)[\(\s]filter\(
226
+
227
+ # exec
228
+ |[^a-zA-Z0-9_]exec\(
192
229
types_or : [python, cython, rst]
230
+ exclude : ^doc/source/development/code_style\.rst # contains examples of patterns to avoid
193
231
- id : cython-casting
194
232
name : Check Cython casting is `<type>obj`, not `<type> obj`
195
233
language : pygrep
@@ -220,6 +258,58 @@ repos:
220
258
files : ^pandas/tests/extension/base
221
259
types : [python]
222
260
exclude : ^pandas/tests/extension/base/base\.py
261
+ - id : unwanted-patterns-in-tests
262
+ name : Unwanted patterns in tests
263
+ language : pygrep
264
+ entry : |
265
+ (?x)
266
+ # pytest.xfail instead of pytest.mark.xfail
267
+ pytest\.xfail
268
+
269
+ # imports from pandas._testing instead of `import pandas._testing as tm`
270
+ |from\ pandas\._testing\ import
271
+ |from\ pandas\ import\ _testing\ as\ tm
272
+
273
+ # No direct imports from conftest
274
+ |conftest\ import
275
+ |import\ conftest
276
+
277
+ # pandas.testing instead of tm
278
+ |pd\.testing\.
279
+
280
+ # pd.api.types instead of from pandas.api.types import ...
281
+ |(pd|pandas)\.api\.types\.
282
+
283
+ # np.testing, np.array_equal
284
+ |(numpy|np)(\.testing|\.array_equal)
285
+
286
+ # unittest.mock (use pytest builtin monkeypatch fixture instead)
287
+ |(unittest(\.| import )mock|mock\.Mock\(\)|mock\.patch)
288
+
289
+ # pytest raises without context
290
+ |\s\ pytest.raises
291
+
292
+ # pytest.warns (use tm.assert_produces_warning instead)
293
+ |pytest\.warns
294
+ files : ^pandas/tests/
295
+ types_or : [python, cython, rst]
296
+ - id : unwanted-patterns-in-ea-tests
297
+ name : Unwanted patterns in EA tests
298
+ language : pygrep
299
+ entry : |
300
+ (?x)
301
+ tm.assert_(series|frame)_equal
302
+ files : ^pandas/tests/extension/base/
303
+ exclude : ^pandas/tests/extension/base/base\.py$
304
+ types_or : [python, cython, rst]
305
+ - id : unwanted-patterns-in-cython
306
+ name : Unwanted patterns in Cython code
307
+ language : pygrep
308
+ entry : |
309
+ (?x)
310
+ # `<type>obj` as opposed to `<type> obj`
311
+ [a-zA-Z0-9*]>[ ]
312
+ types : [cython]
223
313
- id : pip-to-conda
224
314
name : Generate pip dependency from conda
225
315
language : python
@@ -233,6 +323,38 @@ repos:
233
323
language : python
234
324
types : [rst]
235
325
files : ^doc/source/(development|reference)/
326
+ - id : unwanted-patterns-bare-pytest-raises
327
+ name : Check for use of bare pytest raises
328
+ language : python
329
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises"
330
+ types : [python]
331
+ files : ^pandas/tests/
332
+ exclude : ^pandas/tests/extension/
333
+ - id : unwanted-patterns-private-function-across-module
334
+ name : Check for use of private functions across modules
335
+ language : python
336
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
337
+ types : [python]
338
+ exclude : ^(asv_bench|pandas/tests|doc)/
339
+ - id : unwanted-patterns-private-import-across-module
340
+ name : Check for import of private attributes across modules
341
+ language : python
342
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module"
343
+ types : [python]
344
+ exclude : |
345
+ (?x)
346
+ ^(asv_bench|pandas/tests|doc)/
347
+ |scripts/validate_min_versions_in_sync\.py$
348
+ - id : unwanted-patterns-strings-to-concatenate
349
+ name : Check for use of not concatenated strings
350
+ language : python
351
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
352
+ types_or : [python, cython]
353
+ - id : unwanted-patterns-strings-with-misplaced-whitespace
354
+ name : Check for strings with misplaced spaces
355
+ language : python
356
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
357
+ types_or : [python, cython]
236
358
- id : use-pd_array-in-core
237
359
name : Import pandas.array as pd_array in core
238
360
language : python
0 commit comments