Skip to content

Commit 74e69be

Browse files
MarcoGorelliKevin D Smith
authored and
Kevin D Smith
committed
CI move code directives to pre-commit, remove some outdated checks (pandas-dev#37241)
1 parent 6efe8d8 commit 74e69be

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ repos:
6262
|math|module|note|raw|seealso|toctree|versionadded
6363
|versionchanged|warning):[^:]
6464
files: \.(py|pyx|rst)$
65+
- id: incorrect-code-directives
66+
name: Check for incorrect code block or IPython directives
67+
language: pygrep
68+
entry: (\.\. code-block ::|\.\. ipython ::)
69+
files: \.(py|pyx|rst)$
6570
- repo: https://github.com/asottile/yesqa
6671
rev: v1.2.2
6772
hooks:

ci/code_checks.sh

-18
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,6 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
207207
invgrep -r -E --include '*.py' '(unittest(\.| import )mock|mock\.Mock\(\)|mock\.patch)' pandas/tests/
208208
RET=$(($RET + $?)) ; echo $MSG "DONE"
209209

210-
MSG='Check for wrong space after code-block directive and before colon (".. code-block ::" instead of ".. code-block::")' ; echo $MSG
211-
invgrep -R --include="*.rst" ".. code-block ::" doc/source
212-
RET=$(($RET + $?)) ; echo $MSG "DONE"
213-
214-
MSG='Check for wrong space after ipython directive and before colon (".. ipython ::" instead of ".. ipython::")' ; echo $MSG
215-
invgrep -R --include="*.rst" ".. ipython ::" doc/source
216-
RET=$(($RET + $?)) ; echo $MSG "DONE"
217-
218-
MSG='Check for extra blank lines after the class definition' ; echo $MSG
219-
invgrep -R --include="*.py" --include="*.pyx" -E 'class.*:\n\n( )+"""' .
220-
RET=$(($RET + $?)) ; echo $MSG "DONE"
221-
222210
MSG='Check for use of {foo!r} instead of {repr(foo)}' ; echo $MSG
223211
invgrep -R --include=*.{py,pyx} '!r}' pandas
224212
RET=$(($RET + $?)) ; echo $MSG "DONE"
@@ -243,12 +231,6 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
243231
invgrep -R --include=*.{py,pyx} '\.__class__' pandas
244232
RET=$(($RET + $?)) ; echo $MSG "DONE"
245233

246-
MSG='Check that no file in the repo contains trailing whitespaces' ; echo $MSG
247-
INVGREP_APPEND=" <- trailing whitespaces found"
248-
invgrep -RI --exclude=\*.{svg,c,cpp,html,js} --exclude-dir=env "\s$" *
249-
RET=$(($RET + $?)) ; echo $MSG "DONE"
250-
unset INVGREP_APPEND
251-
252234
MSG='Check code for instances of os.remove' ; echo $MSG
253235
invgrep -R --include="*.py*" --exclude "common.py" --exclude "test_writers.py" --exclude "test_store.py" -E "os\.remove" pandas/tests/
254236
RET=$(($RET + $?)) ; echo $MSG "DONE"

0 commit comments

Comments
 (0)