Skip to content

Commit a28a612

Browse files
unifying the flake8 error codes that are being ignored
1 parent 6ace7ef commit a28a612

File tree

2 files changed

+17
-28
lines changed

2 files changed

+17
-28
lines changed

ci/lint.sh

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,35 @@ RET=0
99

1010
### LINTING ###
1111

12-
# We're ignoring the following codes across the board
13-
# E402 module level import not at top of file
14-
# E731 do not assign a lambda expression, use a def
15-
# E741 do not use variables named 'l', 'O', or 'I'
16-
# W503 line break before binary operator
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).
12+
# `setup.cfg` contains the list of error codes that are being ignored in flake8
2113

2214
# pandas/_libs/src is C code, so no need to search there.
2315
MSG='Linting .py code' ; echo $MSG
24-
flake8 pandas --filename=*.py --exclude pandas/_libs/src --ignore=C406,C408,C409,E402,E731,E741,W503
25-
RET=$(($RET + $?)) ; echo $MSG "DONE"
26-
27-
MSG='Linting .pyx code' ; echo $MSG
28-
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,C405,C406,C407,C408,C409,C410,C411
29-
RET=$(($RET + $?)) ; echo $MSG "DONE"
30-
31-
MSG='Linting .pxd and .pxi.in' ; echo $MSG
32-
flake8 pandas/_libs --filename=*.pxi.in,*.pxd --select=E501,E302,E203,E111,E114,E221,E303,E231,E126,F403
16+
flake8 pandas --filename=*.py --exclude pandas/_libs/src
3317
RET=$(($RET + $?)) ; echo $MSG "DONE"
3418

3519
MSG='Linting setup.py' ; echo $MSG
36-
flake8 setup.py --ignore=E402,E731,E741,W503
20+
flake8 setup.py
3721
RET=$(($RET + $?)) ; echo $MSG "DONE"
3822

3923
MSG='Linting scripts' ; echo $MSG
40-
flake8 scripts --filename=*.py --ignore=C408,E402,E731,E741,W503
24+
flake8 scripts --filename=*.py
4125
RET=$(($RET + $?)) ; echo $MSG "DONE"
4226

4327
MSG='Linting asv benchmarks' ; echo $MSG
44-
flake8 asv_bench/benchmarks/ --exclude=asv_bench/benchmarks/*.py --ignore=F811,C406,C408,C409,C410
28+
flake8 asv_bench/benchmarks/ --exclude=asv_bench/benchmarks/*.py
4529
RET=$(($RET + $?)) ; echo $MSG "DONE"
4630

4731
MSG='Linting doc scripts' ; echo $MSG
48-
flake8 doc/make.py doc/source/conf.py --ignore=E402,E731,E741,W503
32+
flake8 doc/make.py doc/source/conf.py
33+
RET=$(($RET + $?)) ; echo $MSG "DONE"
34+
35+
MSG='Linting .pyx code' ; echo $MSG
36+
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,C405,C406,C407,C408,C409,C410,C411
37+
RET=$(($RET + $?)) ; echo $MSG "DONE"
38+
39+
MSG='Linting .pxd and .pxi.in' ; echo $MSG
40+
flake8 pandas/_libs --filename=*.pxi.in,*.pxd --select=E501,E302,E203,E111,E114,E221,E303,E231,E126,F403
4941
RET=$(($RET + $?)) ; echo $MSG "DONE"
5042

5143
# readability/casting: Warnings about C casting instead of C++ casting

setup.cfg

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ parentdir_prefix = pandas-
1313

1414
[flake8]
1515
ignore =
16+
W503, # line break before binary operator
1617
E402, # module level import not at top of file
18+
E722, # do not use bare except
1719
E731, # do not assign a lambda expression, use a def
18-
W503, # line break before binary operator
19-
C405, # Unnecessary (list/tuple) literal - rewrite as a set literal.
20-
C406, # Unnecessary (list/tuple) literal - rewrite as a dict literal.
21-
C408, # Unnecessary (dict/list/tuple) call - rewrite as a literal.
22-
C409, # Unnecessary (list/tuple) passed to tuple() - (remove the outer call to tuple()/rewrite as a tuple literal).
23-
C410 # Unnecessary (list/tuple) passed to list() - (remove the outer call to list()/rewrite as a list literal).
20+
E741 # ambiguous variable name 'l'
2421
max-line-length = 79
2522

2623
[yapf]

0 commit comments

Comments
 (0)