@@ -15,33 +15,36 @@ repos:
1515 - id : flake8
1616 name : flake8 (cython template)
1717 files : \.pxi\.in$
18- types :
19- - file
18+ types : [text]
2019 args : [--append-config=flake8/cython-template.cfg]
2120- repo : https://github.com/PyCQA/isort
22- rev : 5.6.3
21+ rev : 5.6.4
2322 hooks :
2423 - id : isort
2524 name : isort (python)
2625 - id : isort
2726 name : isort (cython)
2827 types : [cython]
2928- repo : https://github.com/asottile/pyupgrade
30- rev : v2.7.2
29+ rev : v2.7.3
3130 hooks :
3231 - id : pyupgrade
3332 args : [--py37-plus]
3433- repo : https://github.com/pre-commit/pygrep-hooks
35- rev : v1.6 .0
34+ rev : v1.7 .0
3635 hooks :
3736 - id : rst-backticks
37+ - id : rst-directive-colons
38+ types : [text]
39+ - id : rst-inline-touching-normal
40+ types : [text]
3841- repo : local
3942 hooks :
4043 - id : pip_to_conda
4144 name : Generate pip dependency from conda
4245 description : This hook checks if the conda environment.yml and requirements-dev.txt are equal
4346 language : python
44- entry : python -m scripts. generate_pip_deps_from_conda
47+ entry : python scripts/ generate_pip_deps_from_conda.py
4548 files : ^(environment.yml|requirements-dev.txt)$
4649 pass_filenames : false
4750 additional_dependencies : [pyyaml]
@@ -53,26 +56,111 @@ repos:
5356 types : [rst]
5457 args : [--filename=*.rst]
5558 additional_dependencies : [flake8-rst==0.7.0, flake8==3.7.9]
56- - id : incorrect-sphinx-directives
57- name : Check for incorrect Sphinx directives
59+ - id : non-standard-imports
60+ name : Check for non-standard imports
5861 language : pygrep
59- entry : >-
60- \.\. (autosummary|contents|currentmodule|deprecated
61- |function|image|important|include|ipython|literalinclude
62- |math|module|note|raw|seealso|toctree|versionadded
63- |versionchanged|warning):[^:]
64- files : \.(py|pyx|rst)$
62+ entry : |
63+ (?x)
64+ # Check for imports from pandas.core.common instead of `import pandas.core.common as com`
65+ from\ pandas\.core\.common\ import|
66+ from\ pandas\.core\ import\ common|
67+
68+ # Check for imports from collections.abc instead of `from collections import abc`
69+ 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]
81+ - id : non-standard-imports-in-tests
82+ name : Check for non-standard imports in test suite
83+ language : pygrep
84+ entry : |
85+ (?x)
86+ # Check for imports from pandas._testing instead of `import pandas._testing as tm`
87+ from\ pandas\._testing\ import|
88+ from\ pandas\ import\ _testing\ as\ tm|
89+
90+ # No direct imports from conftest
91+ conftest\ import|
92+ import\ conftest
93+ types : [python]
94+ files : ^pandas/tests/
6595 - id : incorrect-code-directives
6696 name : Check for incorrect code block or IPython directives
6797 language : pygrep
6898 entry : (\.\. code-block ::|\.\. ipython ::)
6999 files : \.(py|pyx|rst)$
100+ - id : unwanted-patterns-strings-to-concatenate
101+ name : Check for use of not concatenated strings
102+ language : python
103+ entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
104+ files : \.(py|pyx|pxd|pxi)$
105+ - id : unwanted-patterns-strings-with-wrong-placed-whitespace
106+ name : Check for strings with wrong placed spaces
107+ language : python
108+ entry : python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
109+ files : \.(py|pyx|pxd|pxi)$
110+ - id : unwanted-patterns-private-import-across-module
111+ name : Check for import of private attributes across modules
112+ language : python
113+ entry : python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module"
114+ types : [python]
115+ exclude : ^(asv_bench|pandas/tests|doc)/
116+ - id : unwanted-patterns-private-function-across-module
117+ name : Check for use of private functions across modules
118+ language : python
119+ entry : python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
120+ types : [python]
121+ exclude : ^(asv_bench|pandas/tests|doc)/
122+ - id : inconsistent-namespace-usage
123+ name : ' Check for inconsistent use of pandas namespace in tests'
124+ entry : python scripts/check_for_inconsistent_pandas_namespace.py
125+ language : python
126+ types : [python]
127+ files : ^pandas/tests/
128+ - id : FrameOrSeriesUnion
129+ name : Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
130+ entry : Union\[.*(Series.*DataFrame|DataFrame.*Series).*\]
131+ language : pygrep
132+ types : [python]
133+ exclude : ^pandas/_typing\.py$
134+ - id : type-not-class
135+ name : Check for use of foo.__class__ instead of type(foo)
136+ entry : \.__class__
137+ language : pygrep
138+ files : \.(py|pyx)$
139+ - id : unwanted-typing
140+ name : Check for use of comment-based annotation syntax and missing error codes
141+ entry : |
142+ (?x)
143+ \#\ type:\ (?!ignore)|
144+ \#\ type:\s?ignore(?!\[)
145+ language : pygrep
146+ types : [python]
147+ - id : no-os-remove
148+ name : Check code for instances of os.remove
149+ entry : os\.remove
150+ language : pygrep
151+ types : [python]
152+ files : ^pandas/tests/
153+ exclude : |
154+ (?x)^
155+ pandas/tests/io/excel/test_writers\.py|
156+ pandas/tests/io/pytables/common\.py|
157+ pandas/tests/io/pytables/test_store\.py$
70158 - repo : https://github.com/asottile/yesqa
71159 rev : v1.2.2
72160 hooks :
73161 - id : yesqa
74162- repo : https://github.com/pre-commit/pre-commit-hooks
75- rev : v3.2 .0
163+ rev : v3.3 .0
76164 hooks :
77165 - id : end-of-file-fixer
78166 exclude : ^LICENSES/|\.(html|csv|txt|svg|py)$
0 commit comments