9
9
# In the future we may want to add the validation of docstrings and other checks here.
10
10
#
11
11
# Usage:
12
- # $ ./ci/code_checks.sh # run all checks
13
- # $ ./ci/code_checks.sh lint # run linting only
14
- # $ ./ci/code_checks.sh patterns # check for patterns that should not exist
15
- # $ ./ci/code_checks.sh doctests # run doctests
12
+ # $ ./ci/code_checks.sh # run all checks
13
+ # $ ./ci/code_checks.sh lint # run linting only
14
+ # $ ./ci/code_checks.sh patterns # check for patterns that should not exist
15
+ # $ ./ci/code_checks.sh doctests # run doctests
16
+ # $ ./ci/code_checks.sh dependencies # check that dependencies are consistent
16
17
17
18
echo " inside $0 "
18
19
[[ $LINT ]] || { echo " NOT Linting. To lint use: LINT=true $0 $1 " ; exit 0; }
19
- [[ -z " $1 " || " $1 " == " lint" || " $1 " == " patterns" || " $1 " == " doctests" ]] || { echo " Unknown command $1 . Usage: $0 [lint|patterns|doctests]" ; exit 9999; }
20
+ [[ -z " $1 " || " $1 " == " lint" || " $1 " == " patterns" || " $1 " == " doctests" || " $1 " == " dependencies" ]] \
21
+ || { echo " Unknown command $1 . Usage: $0 [lint|patterns|doctests|dependencies]" ; exit 9999; }
20
22
21
23
source activate pandas
24
+ BASE_DIR=" $( dirname $0 ) /.."
22
25
RET=0
23
26
CHECK=$1
24
27
@@ -44,6 +47,13 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
44
47
flake8 pandas/_libs --filename=* .pxi.in,* .pxd --select=E501,E302,E203,E111,E114,E221,E303,E231,E126,F403
45
48
RET=$(( $RET + $? )) ; echo $MSG " DONE"
46
49
50
+ echo " flake8-rst --version"
51
+ flake8-rst --version
52
+
53
+ MSG=' Linting code-blocks in .rst documentation' ; echo $MSG
54
+ flake8-rst doc/source --filename=* .rst
55
+ RET=$(( $RET + $? )) ; echo $MSG " DONE"
56
+
47
57
# Check that cython casting is of the form `<type>obj` as opposed to `<type> obj`;
48
58
# it doesn't make a difference, but we want to be internally consistent.
49
59
# Note: this grep pattern is (intended to be) equivalent to the python
@@ -64,6 +74,9 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
64
74
cpplint --quiet --extensions=c,h --headers=h --recursive --filter=-readability/casting,-runtime/int,-build/include_subdir pandas/_libs/src/* .h pandas/_libs/src/parser pandas/_libs/ujson pandas/_libs/tslibs/src/datetime
65
75
RET=$(( $RET + $? )) ; echo $MSG " DONE"
66
76
77
+ echo " isort --version-number"
78
+ isort --version-number
79
+
67
80
# Imports - Check formatting using isort see setup.cfg for settings
68
81
MSG=' Check import format using isort ' ; echo $MSG
69
82
isort --recursive --check-only pandas
@@ -109,6 +122,10 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
109
122
! grep -R --include=" *.py" --include=" *.pyx" --include=" *.rst" -E " \.\. (autosummary|contents|currentmodule|deprecated|function|image|important|include|ipython|literalinclude|math|module|note|raw|seealso|toctree|versionadded|versionchanged|warning):[^:]" ./pandas ./doc/source
110
123
RET=$(( $RET + $? )) ; echo $MSG " DONE"
111
124
125
+ MSG=' Check that the deprecated `assert_raises_regex` is not used (`pytest.raises(match=pattern)` should be used instead)' ; echo $MSG
126
+ ! grep -R --exclude=* .pyc --exclude=testing.py --exclude=test_testing.py assert_raises_regex pandas
127
+ RET=$(( $RET + $? )) ; echo $MSG " DONE"
128
+
112
129
MSG=' Check for modules that pandas should not import' ; echo $MSG
113
130
python -c "
114
131
import sys
@@ -141,7 +158,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
141
158
142
159
MSG=' Doctests generic.py' ; echo $MSG
143
160
pytest -q --doctest-modules pandas/core/generic.py \
144
- -k" -_set_axis_name -_xs -describe -droplevel -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -resample - to_json -transpose -values -xs"
161
+ -k" -_set_axis_name -_xs -describe -droplevel -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -to_json -transpose -values -xs"
145
162
RET=$(( $RET + $? )) ; echo $MSG " DONE"
146
163
147
164
MSG=' Doctests top-level reshaping functions' ; echo $MSG
@@ -162,4 +179,11 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
162
179
163
180
fi
164
181
182
+ # ## DEPENDENCIES ###
183
+ if [[ -z " $CHECK " || " $CHECK " == " dependencies" ]]; then
184
+ MSG=' Check that requirements-dev.txt has been generated from environment.yml' ; echo $MSG
185
+ $BASE_DIR /scripts/generate_pip_deps_from_conda.py --compare
186
+ RET=$(( $RET + $? )) ; echo $MSG " DONE"
187
+ fi
188
+
165
189
exit $RET
0 commit comments