@@ -90,11 +90,6 @@ repos:
90
90
entry : python scripts/check_for_inconsistent_pandas_namespace.py
91
91
language : python
92
92
types : [python]
93
- - id : incorrect-code-directives
94
- name : Check for incorrect code block or IPython directives
95
- language : pygrep
96
- entry : (\.\. code-block ::|\.\. ipython ::)
97
- types_or : [python, cython, rst]
98
93
- id : no-os-remove
99
94
name : Check code for instances of os.remove
100
95
entry : os\.remove
@@ -106,49 +101,60 @@ repos:
106
101
pandas/tests/io/excel/test_writers\.py
107
102
|pandas/tests/io/pytables/common\.py
108
103
|pandas/tests/io/pytables/test_store\.py$
109
- - id : non-standard-imports
110
- name : Check for non-standard imports
104
+ - id : unwanted-patterns
105
+ name : Unwanted patterns
111
106
language : pygrep
112
107
entry : |
113
108
(?x)
114
- # Check for imports from pandas.core.common instead of `import pandas.core.common as com`
115
- from\ pandas\.core\.common\ import
109
+ # outdated annotation syntax, missing error codes
110
+ \#\ type:\ (?!ignore)
111
+ |\#\ type:\s?ignore(?!\[)
112
+
113
+ # foo._class__ instead of type(foo)
114
+ |\.__class__
115
+
116
+ # np.bool/np.object instead of np.bool_/np.object_
117
+ |np\.bool[^_8]
118
+ |np\.object[^_8]
119
+
120
+ # imports from pandas.core.common instead of `import pandas.core.common as com`
121
+ |from\ pandas\.core\.common\ import
116
122
|from\ pandas\.core\ import\ common
117
123
118
- # Check for imports from collections.abc instead of `from collections import abc`
124
+ # imports from collections.abc instead of `from collections import abc`
119
125
|from\ collections\.abc\ import
120
126
121
127
# Numpy
122
128
|from\ numpy\ import\ random
123
129
|from\ numpy\.random\ import
124
- types : [python]
125
- - id : non-standard-imports-in-tests
126
- name : Check for non-standard imports in test suite
130
+
131
+ # Incorrect code-block / IPython directives
132
+ |\.\.\ code-block\ ::
133
+ |\.\.\ ipython\ ::
134
+ types_or : [python, cython, rst]
135
+ exclude : ^doc/source/development/code_style\.rst # contains examples of patterns to avoid
136
+ - id : unwanted-patterns-in-tests
137
+ name : Unwanted patterns in tests
127
138
language : pygrep
128
139
entry : |
129
140
(?x)
130
- # Check for imports from pandas._testing instead of `import pandas._testing as tm`
131
- from\ pandas\._testing\ import
141
+ # pytest.xfail instead of pytest.mark.xfail
142
+ pytest\.xfail
143
+
144
+ # imports from pandas._testing instead of `import pandas._testing as tm`
145
+ |from\ pandas\._testing\ import
132
146
|from\ pandas\ import\ _testing\ as\ tm
133
147
134
148
# No direct imports from conftest
135
149
|conftest\ import
136
150
|import\ conftest
137
151
138
- # Check for use of pandas.testing instead of tm
152
+ # pandas.testing instead of tm
139
153
|pd\.testing\.
140
154
141
- # Check for pd.api.types instead of from pandas.api.types import ...
155
+ # pd.api.types instead of from pandas.api.types import ...
142
156
|(pd|pandas)\.api\.types\.
143
- types : [python]
144
157
files : ^pandas/tests/
145
- - id : np-bool-and-np-object
146
- name : Check for use of np.bool/np.object instead of np.bool_/np.object_
147
- entry : |
148
- (?x)
149
- np\.bool[^_8]
150
- |np\.object[^_8]
151
- language : pygrep
152
158
types_or : [python, cython, rst]
153
159
- id : pip-to-conda
154
160
name : Generate pip dependency from conda
@@ -164,11 +170,6 @@ repos:
164
170
language : python
165
171
types : [rst]
166
172
files : ^doc/source/(development|reference)/
167
- - id : type-not-class
168
- name : Check for use of foo.__class__ instead of type(foo)
169
- entry : \.__class__
170
- language : pygrep
171
- types_or : [python, cython]
172
173
- id : unwanted-patterns-bare-pytest-raises
173
174
name : Check for use of bare pytest raises
174
175
language : python
@@ -188,12 +189,6 @@ repos:
188
189
entry : python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module"
189
190
types : [python]
190
191
exclude : ^(asv_bench|pandas/tests|doc)/
191
- - id : unwanted-patterns-pytest-xfail
192
- name : Check for use of pytest.xfail
193
- entry : pytest\.xfail
194
- language : pygrep
195
- types : [python]
196
- files : ^pandas/tests/
197
192
- id : unwanted-patterns-strings-to-concatenate
198
193
name : Check for use of not concatenated strings
199
194
language : python
@@ -204,14 +199,6 @@ repos:
204
199
language : python
205
200
entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
206
201
types_or : [python, cython]
207
- - id : unwanted-typing
208
- name : Check for outdated annotation syntax and missing error codes
209
- entry : |
210
- (?x)
211
- \#\ type:\ (?!ignore)
212
- |\#\ type:\s?ignore(?!\[)
213
- language : pygrep
214
- types : [python]
215
202
- id : use-pd_array-in-core
216
203
name : Import pandas.array as pd_array in core
217
204
language : python
0 commit comments