11minimum_pre_commit_version : 2.9.2
22exclude : ^LICENSES/|\.(html|csv|svg)$
33repos :
4+ - repo : https://github.com/MarcoGorelli/absolufy-imports
5+ rev : v0.2.1
6+ hooks :
7+ - id : absolufy-imports
8+ files : ^pandas/
49- repo : https://github.com/python/black
510 rev : 20.8b1
611 hooks :
712 - 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']
836- repo : https://gitlab.com/pycqa/flake8
937 rev : 3.8.4
1038 hooks :
@@ -23,29 +51,31 @@ repos:
2351 rev : 5.7.0
2452 hooks :
2553 - id : isort
54+ - repo : https://github.com/MarcoGorelli/no-string-hints
55+ rev : v0.1.7
56+ hooks :
57+ - id : no-string-hints
2658- repo : https://github.com/asottile/pyupgrade
2759 rev : v2.10.0
2860 hooks :
2961 - id : pyupgrade
3062 args : [--py37-plus, --keep-runtime-typing]
3163- repo : https://github.com/pre-commit/pygrep-hooks
32- rev : v1.7.1
64+ rev : v1.8.0
3365 hooks :
3466 - id : rst-backticks
3567 - id : rst-directive-colons
36- types : [text]
68+ types : [text] # overwrite types: [rst]
69+ types_or : [python, rst]
3770 - 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
3977- repo : local
4078 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]
4979 - id : flake8-rst
5080 name : flake8-rst
5181 description : Run flake8 on code snippets in docstrings or RST files
@@ -54,6 +84,40 @@ repos:
5484 types : [rst]
5585 args : [--filename=*.rst]
5686 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/
57121 - id : non-standard-imports
58122 name : Check for non-standard imports
59123 language : pygrep
@@ -65,17 +129,6 @@ repos:
65129
66130 # Check for imports from collections.abc instead of `from collections import abc`
67131 |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]
79132 - id : non-standard-imports-in-tests
80133 name : Check for non-standard imports in test suite
81134 language : pygrep
@@ -93,62 +146,79 @@ repos:
93146 |pd\.testing\.
94147 types : [python]
95148 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]
98162 language : pygrep
99- entry : (\.\. code-block ::|\.\. ipython ::)
100163 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
103172 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
108180 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
110187 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
113190 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 "
115192 types : [python]
116- exclude : ^(asv_bench|pandas/tests|doc)/
193+ files : ^pandas/tests/
194+ exclude : ^pandas/tests/extension/
117195 - id : unwanted-patterns-private-function-across-module
118196 name : Check for use of private functions across modules
119197 language : python
120198 entry : python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
121199 types : [python]
122200 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
125203 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 "
127205 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
131208 name : Check for use of pytest.xfail
132209 entry : pytest\.xfail
133210 language : pygrep
134211 types : [python]
135212 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
139215 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"
152222 types_or : [python, cython]
153223 - id : unwanted-typing
154224 name : Check for outdated annotation syntax and missing error codes
@@ -158,57 +228,3 @@ repos:
158228 |\#\ type:\s?ignore(?!\[)
159229 language : pygrep
160230 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