34
34
types_or : [python, rst, markdown]
35
35
additional_dependencies : [tomli]
36
36
- repo : https://github.com/MarcoGorelli/cython-lint
37
- rev : v0.9 .1
37
+ rev : v0.10 .1
38
38
hooks :
39
39
- id : cython-lint
40
40
- id : double-quote-cython-strings
@@ -70,19 +70,16 @@ repos:
70
70
rev : 6.0.0
71
71
hooks :
72
72
- id : flake8
73
- # Need to patch os.remove rule in pandas-dev-flaker
74
- exclude : ^ci/fix_wheels.py
75
73
additional_dependencies : &flake8_dependencies
76
74
- flake8==6.0.0
77
75
- flake8-bugbear==22.7.1
78
- - pandas-dev-flaker==0.5.0
79
76
- repo : https://github.com/pycqa/pylint
80
- rev : v2.15.6
77
+ rev : v2.15.9
81
78
hooks :
82
79
- id : pylint
83
80
stages : [manual]
84
81
- repo : https://github.com/pycqa/pylint
85
- rev : v2.15.6
82
+ rev : v2.15.9
86
83
hooks :
87
84
- id : pylint
88
85
alias : redefined-outer-name
@@ -95,15 +92,14 @@ repos:
95
92
|^pandas/util/_test_decorators\.py # keep excluded
96
93
|^pandas/_version\.py # keep excluded
97
94
|^pandas/conftest\.py # keep excluded
98
- |^pandas/core/generic\.py
99
95
args : [--disable=all, --enable=redefined-outer-name]
100
96
stages : [manual]
101
97
- repo : https://github.com/PyCQA/isort
102
- rev : 5.10.1
98
+ rev : 5.11.4
103
99
hooks :
104
100
- id : isort
105
101
- repo : https://github.com/asottile/pyupgrade
106
- rev : v3.2.2
102
+ rev : v3.3.1
107
103
hooks :
108
104
- id : pyupgrade
109
105
args : [--py38-plus]
@@ -184,6 +180,21 @@ repos:
184
180
types : [rst]
185
181
args : [--filename=*.rst]
186
182
additional_dependencies : [flake8-rst==0.7.0, flake8==3.7.9]
183
+ - id : inconsistent-namespace-usage
184
+ name : ' Check for inconsistent use of pandas namespace'
185
+ entry : python scripts/check_for_inconsistent_pandas_namespace.py
186
+ exclude : ^pandas/core/interchange/
187
+ language : python
188
+ types : [python]
189
+ - id : no-os-remove
190
+ name : Check code for instances of os.remove
191
+ entry : os\.remove
192
+ language : pygrep
193
+ types : [python]
194
+ files : ^pandas/tests/
195
+ exclude : |
196
+ (?x)^
197
+ pandas/tests/io/pytables/test_store\.py$
187
198
- id : unwanted-patterns
188
199
name : Unwanted patterns
189
200
language : pygrep
@@ -193,6 +204,20 @@ repos:
193
204
\#\ type:\ (?!ignore)
194
205
|\#\ type:\s?ignore(?!\[)
195
206
207
+ # foo._class__ instead of type(foo)
208
+ |\.__class__
209
+
210
+ # np.bool/np.object instead of np.bool_/np.object_
211
+ |np\.bool[^_8`]
212
+ |np\.object[^_8`]
213
+
214
+ # imports from collections.abc instead of `from collections import abc`
215
+ |from\ collections\.abc\ import
216
+
217
+ # Numpy
218
+ |from\ numpy\ import\ random
219
+ |from\ numpy\.random\ import
220
+
196
221
# Incorrect code-block / IPython directives
197
222
|\.\.\ code-block\ ::
198
223
|\.\.\ ipython\ ::
@@ -201,7 +226,17 @@ repos:
201
226
202
227
# Check for deprecated messages without sphinx directive
203
228
|(DEPRECATED|DEPRECATE|Deprecated)(:|,|\.)
229
+
230
+ # {foo!r} instead of {repr(foo)}
231
+ |!r}
232
+
233
+ # builtin filter function
234
+ |(?<!def)[\(\s]filter\(
235
+
236
+ # exec
237
+ |[^a-zA-Z0-9_]exec\(
204
238
types_or : [python, cython, rst]
239
+ exclude : ^doc/source/development/code_style\.rst # contains examples of patterns to avoid
205
240
- id : cython-casting
206
241
name : Check Cython casting is `<type>obj`, not `<type> obj`
207
242
language : pygrep
@@ -232,6 +267,58 @@ repos:
232
267
files : ^pandas/tests/extension/base
233
268
types : [python]
234
269
exclude : ^pandas/tests/extension/base/base\.py
270
+ - id : unwanted-patterns-in-tests
271
+ name : Unwanted patterns in tests
272
+ language : pygrep
273
+ entry : |
274
+ (?x)
275
+ # pytest.xfail instead of pytest.mark.xfail
276
+ pytest\.xfail
277
+
278
+ # imports from pandas._testing instead of `import pandas._testing as tm`
279
+ |from\ pandas\._testing\ import
280
+ |from\ pandas\ import\ _testing\ as\ tm
281
+
282
+ # No direct imports from conftest
283
+ |conftest\ import
284
+ |import\ conftest
285
+
286
+ # pandas.testing instead of tm
287
+ |pd\.testing\.
288
+
289
+ # pd.api.types instead of from pandas.api.types import ...
290
+ |(pd|pandas)\.api\.types\.
291
+
292
+ # np.testing, np.array_equal
293
+ |(numpy|np)(\.testing|\.array_equal)
294
+
295
+ # unittest.mock (use pytest builtin monkeypatch fixture instead)
296
+ |(unittest(\.| import )mock|mock\.Mock\(\)|mock\.patch)
297
+
298
+ # pytest raises without context
299
+ |\s\ pytest.raises
300
+
301
+ # pytest.warns (use tm.assert_produces_warning instead)
302
+ |pytest\.warns
303
+ files : ^pandas/tests/
304
+ types_or : [python, cython, rst]
305
+ - id : unwanted-patterns-in-ea-tests
306
+ name : Unwanted patterns in EA tests
307
+ language : pygrep
308
+ entry : |
309
+ (?x)
310
+ tm.assert_(series|frame)_equal
311
+ files : ^pandas/tests/extension/base/
312
+ exclude : ^pandas/tests/extension/base/base\.py$
313
+ types_or : [python, cython, rst]
314
+ - id : unwanted-patterns-in-cython
315
+ name : Unwanted patterns in Cython code
316
+ language : pygrep
317
+ entry : |
318
+ (?x)
319
+ # `<type>obj` as opposed to `<type> obj`
320
+ [a-zA-Z0-9*]>[ ]
321
+ types : [cython]
235
322
- id : pip-to-conda
236
323
name : Generate pip dependency from conda
237
324
language : python
@@ -252,6 +339,38 @@ repos:
252
339
language : python
253
340
types : [rst]
254
341
files : ^doc/source/(development|reference)/
342
+ - id : unwanted-patterns-bare-pytest-raises
343
+ name : Check for use of bare pytest raises
344
+ language : python
345
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises"
346
+ types : [python]
347
+ files : ^pandas/tests/
348
+ exclude : ^pandas/tests/extension/
349
+ - id : unwanted-patterns-private-function-across-module
350
+ name : Check for use of private functions across modules
351
+ language : python
352
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
353
+ types : [python]
354
+ exclude : ^(asv_bench|pandas/tests|doc)/
355
+ - id : unwanted-patterns-private-import-across-module
356
+ name : Check for import of private attributes across modules
357
+ language : python
358
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module"
359
+ types : [python]
360
+ exclude : |
361
+ (?x)
362
+ ^(asv_bench|pandas/tests|doc)/
363
+ |scripts/validate_min_versions_in_sync\.py$
364
+ - id : unwanted-patterns-strings-to-concatenate
365
+ name : Check for use of not concatenated strings
366
+ language : python
367
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
368
+ types_or : [python, cython]
369
+ - id : unwanted-patterns-strings-with-misplaced-whitespace
370
+ name : Check for strings with misplaced spaces
371
+ language : python
372
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
373
+ types_or : [python, cython]
255
374
- id : use-pd_array-in-core
256
375
name : Import pandas.array as pd_array in core
257
376
language : python
0 commit comments