|
8 | 8 |
|
9 | 9 | if [ "$LINT" ]; then
|
10 | 10 |
|
| 11 | + # We're ignoring the following codes across the board |
| 12 | + #E402, # module level import not at top of file |
| 13 | + #E731, # do not assign a lambda expression, use a def |
| 14 | + #E741, # do not use variables named 'l', 'O', or 'I' |
| 15 | + #W503, # line break before binary operator |
| 16 | + #C405, # Unnecessary (list/tuple) literal - rewrite as a set literal. |
| 17 | + #C406, # Unnecessary (list/tuple) literal - rewrite as a dict literal. |
| 18 | + #C408, # Unnecessary (dict/list/tuple) call - rewrite as a literal. |
| 19 | + #C409, # Unnecessary (list/tuple) passed to tuple() - (remove the outer call to tuple()/rewrite as a tuple literal). |
| 20 | + #C410 # Unnecessary (list/tuple) passed to list() - (remove the outer call to list()/rewrite as a list literal). |
| 21 | + |
11 | 22 | # pandas/_libs/src is C code, so no need to search there.
|
12 | 23 | echo "Linting *.py"
|
13 |
| - flake8 pandas --filename=*.py --exclude pandas/_libs/src |
| 24 | + flake8 pandas --filename=*.py --exclude pandas/_libs/src --ignore=C405,C406,C408,C409,C410,E402,E731,E741,W503 |
14 | 25 | if [ $? -ne "0" ]; then
|
15 | 26 | RET=1
|
16 | 27 | fi
|
17 | 28 | echo "Linting *.py DONE"
|
18 | 29 |
|
19 | 30 | echo "Linting setup.py"
|
20 |
| - flake8 setup.py |
| 31 | + flake8 setup.py --ignore=C405,C406,C408,C409,C410,E402,E731,E741,W503 |
21 | 32 | if [ $? -ne "0" ]; then
|
22 | 33 | RET=1
|
23 | 34 | fi
|
24 | 35 | echo "Linting setup.py DONE"
|
25 | 36 |
|
26 | 37 | echo "Linting asv_bench/benchmarks/"
|
27 |
| - flake8 asv_bench/benchmarks/ --exclude=asv_bench/benchmarks/*.py --ignore=F811 |
| 38 | + flake8 asv_bench/benchmarks/ --exclude=asv_bench/benchmarks/*.py --ignore=F811,C405,C406,C408,C409,C410 |
28 | 39 | if [ $? -ne "0" ]; then
|
29 | 40 | RET=1
|
30 | 41 | fi
|
31 | 42 | echo "Linting asv_bench/benchmarks/*.py DONE"
|
32 | 43 |
|
33 | 44 | echo "Linting scripts/*.py"
|
34 |
| - flake8 scripts --filename=*.py |
| 45 | + flake8 scripts --filename=*.py --ignore=C405,C406,C408,C409,C410,E402,E731,E741,W503 |
35 | 46 | if [ $? -ne "0" ]; then
|
36 | 47 | RET=1
|
37 | 48 | fi
|
38 | 49 | echo "Linting scripts/*.py DONE"
|
39 | 50 |
|
40 | 51 | echo "Linting doc scripts"
|
41 |
| - flake8 doc/make.py doc/source/conf.py |
| 52 | + flake8 doc/make.py doc/source/conf.py --ignore=C405,C406,C408,C409,C410,E402,E731,E741,W503 |
42 | 53 | if [ $? -ne "0" ]; then
|
43 | 54 | RET=1
|
44 | 55 | fi
|
45 | 56 | echo "Linting doc scripts DONE"
|
46 | 57 |
|
47 | 58 | echo "Linting *.pyx"
|
48 |
| - flake8 pandas --filename=*.pyx --select=E501,E302,E203,E111,E114,E221,E303,E128,E231,E126,E265,E305,E301,E127,E261,E271,E129,W291,E222,E241,E123,F403 |
| 59 | + flake8 pandas --filename=*.pyx --select=E501,E302,E203,E111,E114,E221,E303,E128,E231,E126,E265,E305,E301,E127,E261,E271,E129,W291,E222,E241,E123,F403,C400,C401,C402,C403,C404,C407,C411 |
49 | 60 | if [ $? -ne "0" ]; then
|
50 | 61 | RET=1
|
51 | 62 | fi
|
@@ -131,19 +142,6 @@ if [ "$LINT" ]; then
|
131 | 142 | fi
|
132 | 143 | echo "Check for non-standard imports DONE"
|
133 | 144 |
|
134 |
| - echo "Check for use of lists instead of generators in built-in Python functions" |
135 |
| - |
136 |
| - # Example: Avoid `any([i for i in some_iterator])` in favor of `any(i for i in some_iterator)` |
137 |
| - # |
138 |
| - # Check the following functions: |
139 |
| - # any(), all(), sum(), max(), min(), list(), dict(), set(), frozenset(), tuple(), str.join() |
140 |
| - grep -R --include="*.py*" -E "[^_](any|all|sum|max|min|list|dict|set|frozenset|tuple|join)\(\[.* for .* in .*\]\)" pandas |
141 |
| - |
142 |
| - if [ $? = "0" ]; then |
143 |
| - RET=1 |
144 |
| - fi |
145 |
| - echo "Check for use of lists instead of generators in built-in Python functions DONE" |
146 |
| - |
147 | 145 | echo "Check for incorrect sphinx directives"
|
148 | 146 | SPHINX_DIRECTIVES=$(echo \
|
149 | 147 | "autosummary|contents|currentmodule|deprecated|function|image|"\
|
|
0 commit comments