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|doc)/
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
26
+ - repo : https://github.com/cpplint/cpplint
27
+ rev : f7061b1 # the latest tag does not have the hook
28
+ hooks :
29
+ - id : cpplint
30
+ # We don't lint all C files because we don't want to lint any that are built
31
+ # from Cython files nor do we want to lint C files that we didn't modify for
32
+ # this particular codebase (e.g. src/headers, src/klib). However,
33
+ # we can lint all header files since they aren't "generated" like C files are.
34
+ exclude : ^pandas/_libs/src/(klib|headers)/
35
+ args : [--quiet, '--extensions=c,h', '--headers=h', --recursive, '--filter=-readability/casting,-runtime/int,-build/include_subdir']
8
36
- repo : https://gitlab.com/pycqa/flake8
9
37
rev : 3.8.4
10
38
hooks :
@@ -23,29 +51,31 @@ repos:
23
51
rev : 5.7.0
24
52
hooks :
25
53
- id : isort
54
+ - repo : https://github.com/MarcoGorelli/no-string-hints
55
+ rev : v0.1.7
56
+ hooks :
57
+ - id : no-string-hints
26
58
- repo : https://github.com/asottile/pyupgrade
27
59
rev : v2.10.0
28
60
hooks :
29
61
- id : pyupgrade
30
62
args : [--py37-plus, --keep-runtime-typing]
31
63
- repo : https://github.com/pre-commit/pygrep-hooks
32
- rev : v1.7.1
64
+ rev : v1.8.0
33
65
hooks :
34
66
- id : rst-backticks
35
67
- id : rst-directive-colons
36
- types : [text]
68
+ types : [text] # overwrite types: [rst]
69
+ types_or : [python, rst]
37
70
- id : rst-inline-touching-normal
38
- types : [text]
71
+ types : [text] # overwrite types: [rst]
72
+ types_or : [python, rst]
73
+ - repo : https://github.com/asottile/yesqa
74
+ rev : v1.2.2
75
+ hooks :
76
+ - id : yesqa
39
77
- repo : local
40
78
hooks :
41
- - id : pip_to_conda
42
- name : Generate pip dependency from conda
43
- description : This hook checks if the conda environment.yml and requirements-dev.txt are equal
44
- language : python
45
- entry : python scripts/generate_pip_deps_from_conda.py
46
- files : ^(environment.yml|requirements-dev.txt)$
47
- pass_filenames : false
48
- additional_dependencies : [pyyaml]
49
79
- id : flake8-rst
50
80
name : flake8-rst
51
81
description : Run flake8 on code snippets in docstrings or RST files
@@ -54,6 +84,40 @@ repos:
54
84
types : [rst]
55
85
args : [--filename=*.rst]
56
86
additional_dependencies : [flake8-rst==0.7.0, flake8==3.7.9]
87
+ - id : frame-or-series-union
88
+ name : Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
89
+ entry : Union\[.*(Series,.*DataFrame|DataFrame,.*Series).*\]
90
+ language : pygrep
91
+ types : [python]
92
+ exclude : ^pandas/_typing\.py$
93
+ - id : inconsistent-namespace-usage
94
+ name : ' Check for inconsistent use of pandas namespace in tests'
95
+ entry : python scripts/check_for_inconsistent_pandas_namespace.py
96
+ language : python
97
+ types : [python]
98
+ files : ^pandas/tests/
99
+ - id : incorrect-code-directives
100
+ name : Check for incorrect code block or IPython directives
101
+ language : pygrep
102
+ entry : (\.\. code-block ::|\.\. ipython ::)
103
+ types_or : [python, cython, rst]
104
+ - id : no-os-remove
105
+ name : Check code for instances of os.remove
106
+ entry : os\.remove
107
+ language : pygrep
108
+ types : [python]
109
+ files : ^pandas/tests/
110
+ exclude : |
111
+ (?x)^
112
+ pandas/tests/io/excel/test_writers\.py
113
+ |pandas/tests/io/pytables/common\.py
114
+ |pandas/tests/io/pytables/test_store\.py$
115
+ - id : no-pandas-api-types
116
+ name : Check code for instances of pd.api.types
117
+ entry : (pd|pandas)\.api\.types\.
118
+ language : pygrep
119
+ types : [python]
120
+ files : ^pandas/tests/
57
121
- id : non-standard-imports
58
122
name : Check for non-standard imports
59
123
language : pygrep
@@ -65,17 +129,6 @@ repos:
65
129
66
130
# Check for imports from collections.abc instead of `from collections import abc`
67
131
|from\ collections\.abc\ import
68
-
69
- - id : non-standard-numpy.random-related-imports
70
- name : Check for non-standard numpy.random-related imports excluding pandas/_testing.py
71
- language : pygrep
72
- exclude : pandas/_testing.py
73
- entry : |
74
- (?x)
75
- # Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
76
- from\ numpy\ import\ random
77
- |from\ numpy.random\ import
78
- types : [python]
79
132
- id : non-standard-imports-in-tests
80
133
name : Check for non-standard imports in test suite
81
134
language : pygrep
@@ -93,62 +146,79 @@ repos:
93
146
|pd\.testing\.
94
147
types : [python]
95
148
files : ^pandas/tests/
96
- - id : incorrect-code-directives
97
- name : Check for incorrect code block or IPython directives
149
+ - id : non-standard-numpy-random-related-imports
150
+ name : Check for non-standard numpy.random-related imports excluding pandas/_testing.py
151
+ language : pygrep
152
+ exclude : pandas/_testing.py
153
+ entry : |
154
+ (?x)
155
+ # Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
156
+ from\ numpy\ import\ random
157
+ |from\ numpy.random\ import
158
+ types : [python]
159
+ - id : np-bool
160
+ name : Check for use of np.bool instead of np.bool_
161
+ entry : np\.bool[^_8]
98
162
language : pygrep
99
- entry : (\.\. code-block ::|\.\. ipython ::)
100
163
types_or : [python, cython, rst]
101
- - id : unwanted-patterns-strings-to-concatenate
102
- name : Check for use of not concatenated strings
164
+ - id : np-object
165
+ name : Check for use of np.object instead of np.object_
166
+ entry : np\.object[^_8]
167
+ language : pygrep
168
+ types_or : [python, cython, rst]
169
+ - id : pip-to-conda
170
+ name : Generate pip dependency from conda
171
+ description : This hook checks if the conda environment.yml and requirements-dev.txt are equal
103
172
language : python
104
- entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
105
- types_or : [python, cython]
106
- - id : unwanted-patterns-strings-with-wrong-placed-whitespace
107
- name : Check for strings with wrong placed spaces
173
+ entry : python scripts/generate_pip_deps_from_conda.py
174
+ files : ^(environment.yml|requirements-dev.txt)$
175
+ pass_filenames : false
176
+ additional_dependencies : [pyyaml]
177
+ - id : title-capitalization
178
+ name : Validate correct capitalization among titles in documentation
179
+ entry : python scripts/validate_rst_title_capitalization.py
108
180
language : python
109
- entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
181
+ types : [rst]
182
+ files : ^doc/source/(development|reference)/
183
+ - id : type-not-class
184
+ name : Check for use of foo.__class__ instead of type(foo)
185
+ entry : \.__class__
186
+ language : pygrep
110
187
types_or : [python, cython]
111
- - id : unwanted-patterns-private-import-across-module
112
- name : Check for import of private attributes across modules
188
+ - id : unwanted-patterns-bare-pytest-raises
189
+ name : Check for use of bare pytest raises
113
190
language : python
114
- entry : python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module "
191
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises "
115
192
types : [python]
116
- exclude : ^(asv_bench|pandas/tests|doc)/
193
+ files : ^pandas/tests/
194
+ exclude : ^pandas/tests/extension/
117
195
- id : unwanted-patterns-private-function-across-module
118
196
name : Check for use of private functions across modules
119
197
language : python
120
198
entry : python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
121
199
types : [python]
122
200
exclude : ^(asv_bench|pandas/tests|doc)/
123
- - id : unwanted-patterns-bare-pytest-raises
124
- name : Check for use of bare pytest raises
201
+ - id : unwanted-patterns-private-import-across-module
202
+ name : Check for import of private attributes across modules
125
203
language : python
126
- entry : python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises "
204
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module "
127
205
types : [python]
128
- files : ^pandas/tests/
129
- exclude : ^pandas/tests/extension/
130
- - id : unwanted-patters-pytest-xfail
206
+ exclude : ^(asv_bench|pandas/tests|doc)/
207
+ - id : unwanted-patterns-pytest-xfail
131
208
name : Check for use of pytest.xfail
132
209
entry : pytest\.xfail
133
210
language : pygrep
134
211
types : [python]
135
212
files : ^pandas/tests/
136
- - id : inconsistent-namespace-usage
137
- name : ' Check for inconsistent use of pandas namespace in tests'
138
- entry : python scripts/check_for_inconsistent_pandas_namespace.py
213
+ - id : unwanted-patterns-strings-to-concatenate
214
+ name : Check for use of not concatenated strings
139
215
language : python
140
- types : [python]
141
- files : ^pandas/tests/frame/
142
- - id : FrameOrSeriesUnion
143
- name : Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
144
- entry : Union\[.*(Series,.*DataFrame|DataFrame,.*Series).*\]
145
- language : pygrep
146
- types : [python]
147
- exclude : ^pandas/_typing\.py$
148
- - id : type-not-class
149
- name : Check for use of foo.__class__ instead of type(foo)
150
- entry : \.__class__
151
- language : pygrep
216
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
217
+ types_or : [python, cython]
218
+ - id : unwanted-patterns-strings-with-wrong-placed-whitespace
219
+ name : Check for strings with wrong placed spaces
220
+ language : python
221
+ entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
152
222
types_or : [python, cython]
153
223
- id : unwanted-typing
154
224
name : Check for outdated annotation syntax and missing error codes
@@ -158,57 +228,3 @@ repos:
158
228
|\#\ type:\s?ignore(?!\[)
159
229
language : pygrep
160
230
types : [python]
161
- - id : np-bool
162
- name : Check for use of np.bool instead of np.bool_
163
- entry : np\.bool[^_8]
164
- language : pygrep
165
- types_or : [python, cython, rst]
166
- - id : no-os-remove
167
- name : Check code for instances of os.remove
168
- entry : os\.remove
169
- language : pygrep
170
- types : [python]
171
- files : ^pandas/tests/
172
- exclude : |
173
- (?x)^
174
- pandas/tests/io/excel/test_writers\.py
175
- |pandas/tests/io/pytables/common\.py
176
- |pandas/tests/io/pytables/test_store\.py$
177
- - id : no-pandas-api-types
178
- name : Check code for instances of pd.api.types
179
- entry : (pd|pandas)\.api\.types\.
180
- language : pygrep
181
- types : [python]
182
- files : ^pandas/tests/
183
- - id : title-capitalization
184
- name : Validate correct capitalization among titles in documentation
185
- entry : python scripts/validate_rst_title_capitalization.py
186
- language : python
187
- types : [rst]
188
- files : ^doc/source/(development|reference)/
189
- - repo : https://github.com/asottile/yesqa
190
- rev : v1.2.2
191
- hooks :
192
- - id : yesqa
193
- - repo : https://github.com/pre-commit/pre-commit-hooks
194
- rev : v3.4.0
195
- hooks :
196
- - id : end-of-file-fixer
197
- exclude : \.txt$
198
- - id : trailing-whitespace
199
- - repo : https://github.com/codespell-project/codespell
200
- rev : v2.0.0
201
- hooks :
202
- - id : codespell
203
- types_or : [python, rst, markdown]
204
- files : ^pandas/
205
- exclude : ^pandas/tests/
206
- - repo : https://github.com/MarcoGorelli/no-string-hints
207
- rev : v0.1.7
208
- hooks :
209
- - id : no-string-hints
210
- - repo : https://github.com/MarcoGorelli/abs-imports
211
- rev : v0.1.2
212
- hooks :
213
- - id : abs-imports
214
- files : ^pandas/
0 commit comments