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,6 +51,10 @@ 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 :
@@ -38,16 +70,12 @@ repos:
3870 - id : rst-inline-touching-normal
3971 types : [text] # overwrite types: [rst]
4072 types_or : [python, rst]
73+ - repo : https://github.com/asottile/yesqa
74+ rev : v1.2.2
75+ hooks :
76+ - id : yesqa
4177- repo : local
4278 hooks :
43- - id : pip_to_conda
44- name : Generate pip dependency from conda
45- description : This hook checks if the conda environment.yml and requirements-dev.txt are equal
46- language : python
47- entry : python scripts/generate_pip_deps_from_conda.py
48- files : ^(environment.yml|requirements-dev.txt)$
49- pass_filenames : false
50- additional_dependencies : [pyyaml]
5179 - id : flake8-rst
5280 name : flake8-rst
5381 description : Run flake8 on code snippets in docstrings or RST files
@@ -56,6 +84,40 @@ repos:
5684 types : [rst]
5785 args : [--filename=*.rst]
5886 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/frame/
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/
59121 - id : non-standard-imports
60122 name : Check for non-standard imports
61123 language : pygrep
@@ -67,17 +129,6 @@ repos:
67129
68130 # Check for imports from collections.abc instead of `from collections import abc`
69131 |from\ collections\.abc\ import
70-
71- - id : non-standard-numpy.random-related-imports
72- name : Check for non-standard numpy.random-related imports excluding pandas/_testing.py
73- language : pygrep
74- exclude : pandas/_testing.py
75- entry : |
76- (?x)
77- # Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
78- from\ numpy\ import\ random
79- |from\ numpy.random\ import
80- types : [python]
81132 - id : non-standard-imports-in-tests
82133 name : Check for non-standard imports in test suite
83134 language : pygrep
@@ -95,62 +146,79 @@ repos:
95146 |pd\.testing\.
96147 types : [python]
97148 files : ^pandas/tests/
98- - id : incorrect-code-directives
99- 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]
100162 language : pygrep
101- entry : (\.\. code-block ::|\.\. ipython ::)
102163 types_or : [python, cython, rst]
103- - id : unwanted-patterns-strings-to-concatenate
104- 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
105172 language : python
106- entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
107- types_or : [python, cython]
108- - id : unwanted-patterns-strings-with-wrong-placed-whitespace
109- 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
110180 language : python
111- 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
112187 types_or : [python, cython]
113- - id : unwanted-patterns-private-import-across-module
114- 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
115190 language : python
116- 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 "
117192 types : [python]
118- exclude : ^(asv_bench|pandas/tests|doc)/
193+ files : ^pandas/tests/
194+ exclude : ^pandas/tests/extension/
119195 - id : unwanted-patterns-private-function-across-module
120196 name : Check for use of private functions across modules
121197 language : python
122198 entry : python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
123199 types : [python]
124200 exclude : ^(asv_bench|pandas/tests|doc)/
125- - id : unwanted-patterns-bare-pytest-raises
126- 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
127203 language : python
128- 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 "
129205 types : [python]
130- files : ^pandas/tests/
131- exclude : ^pandas/tests/extension/
132- - id : unwanted-patters-pytest-xfail
206+ exclude : ^(asv_bench|pandas/tests|doc)/
207+ - id : unwanted-patterns-pytest-xfail
133208 name : Check for use of pytest.xfail
134209 entry : pytest\.xfail
135210 language : pygrep
136211 types : [python]
137212 files : ^pandas/tests/
138- - id : inconsistent-namespace-usage
139- name : ' Check for inconsistent use of pandas namespace in tests'
140- 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
141215 language : python
142- types : [python]
143- files : ^pandas/tests/frame/
144- - id : FrameOrSeriesUnion
145- name : Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
146- entry : Union\[.*(Series,.*DataFrame|DataFrame,.*Series).*\]
147- language : pygrep
148- types : [python]
149- exclude : ^pandas/_typing\.py$
150- - id : type-not-class
151- name : Check for use of foo.__class__ instead of type(foo)
152- entry : \.__class__
153- 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"
154222 types_or : [python, cython]
155223 - id : unwanted-typing
156224 name : Check for outdated annotation syntax and missing error codes
@@ -160,62 +228,3 @@ repos:
160228 |\#\ type:\s?ignore(?!\[)
161229 language : pygrep
162230 types : [python]
163- - id : np-bool
164- name : Check for use of np.bool instead of np.bool_
165- entry : np\.bool[^_8]
166- language : pygrep
167- types_or : [python, cython, rst]
168- - id : np-object
169- name : Check for use of np.object instead of np.object_
170- entry : np\.object[^_8]
171- language : pygrep
172- types_or : [python, cython, rst]
173- - id : no-os-remove
174- name : Check code for instances of os.remove
175- entry : os\.remove
176- language : pygrep
177- types : [python]
178- files : ^pandas/tests/
179- exclude : |
180- (?x)^
181- pandas/tests/io/excel/test_writers\.py
182- |pandas/tests/io/pytables/common\.py
183- |pandas/tests/io/pytables/test_store\.py$
184- - id : no-pandas-api-types
185- name : Check code for instances of pd.api.types
186- entry : (pd|pandas)\.api\.types\.
187- language : pygrep
188- types : [python]
189- files : ^pandas/tests/
190- - id : title-capitalization
191- name : Validate correct capitalization among titles in documentation
192- entry : python scripts/validate_rst_title_capitalization.py
193- language : python
194- types : [rst]
195- files : ^doc/source/(development|reference)/
196- - repo : https://github.com/asottile/yesqa
197- rev : v1.2.2
198- hooks :
199- - id : yesqa
200- - repo : https://github.com/pre-commit/pre-commit-hooks
201- rev : v3.4.0
202- hooks :
203- - id : end-of-file-fixer
204- exclude : \.txt$
205- - id : trailing-whitespace
206- - repo : https://github.com/codespell-project/codespell
207- rev : v2.0.0
208- hooks :
209- - id : codespell
210- types_or : [python, rst, markdown]
211- files : ^pandas/
212- exclude : ^pandas/tests/
213- - repo : https://github.com/MarcoGorelli/no-string-hints
214- rev : v0.1.7
215- hooks :
216- - id : no-string-hints
217- - repo : https://github.com/MarcoGorelli/absolufy-imports
218- rev : v0.2.1
219- hooks :
220- - id : absolufy-imports
221- files : ^pandas/
0 commit comments