-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN/STYLE: Lint comprehensions #22075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1ed7e82
b94f687
040098d
2a1e63a
e3b97b0
cf9998a
bfb3150
1665bff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,42 +10,42 @@ if [ "$LINT" ]; then | |
|
||
# pandas/_libs/src is C code, so no need to search there. | ||
echo "Linting *.py" | ||
flake8 pandas --filename=*.py --exclude pandas/_libs/src | ||
flake8 pandas --filename=*.py --exclude pandas/_libs/src --ignore=C405,C406,C408,C409,C410,E402,E731,E741,W503 | ||
if [ $? -ne "0" ]; then | ||
RET=1 | ||
fi | ||
echo "Linting *.py DONE" | ||
|
||
echo "Linting setup.py" | ||
flake8 setup.py | ||
flake8 setup.py --ignore=C405,C406,C408,C409,C410,E402,E731,E741,W503 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. e.g. here if you'd document why these codes (general comments are enough), though if specific ones can be removed pls do that. also maybe want to add these to |
||
if [ $? -ne "0" ]; then | ||
RET=1 | ||
fi | ||
echo "Linting setup.py DONE" | ||
|
||
echo "Linting asv_bench/benchmarks/" | ||
flake8 asv_bench/benchmarks/ --exclude=asv_bench/benchmarks/*.py --ignore=F811 | ||
flake8 asv_bench/benchmarks/ --exclude=asv_bench/benchmarks/*.py --ignore=F811,C405,C406,C408,C409,C410 | ||
if [ $? -ne "0" ]; then | ||
RET=1 | ||
fi | ||
echo "Linting asv_bench/benchmarks/*.py DONE" | ||
|
||
echo "Linting scripts/*.py" | ||
flake8 scripts --filename=*.py | ||
flake8 scripts --filename=*.py --ignore=C405,C406,C408,C409,C410,E402,E731,E741,W503 | ||
if [ $? -ne "0" ]; then | ||
RET=1 | ||
fi | ||
echo "Linting scripts/*.py DONE" | ||
|
||
echo "Linting doc scripts" | ||
flake8 doc/make.py doc/source/conf.py | ||
flake8 doc/make.py doc/source/conf.py --ignore=C405,C406,C408,C409,C410,E402,E731,E741,W503 | ||
if [ $? -ne "0" ]; then | ||
RET=1 | ||
fi | ||
echo "Linting doc scripts DONE" | ||
|
||
echo "Linting *.pyx" | ||
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 | ||
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 | ||
if [ $? -ne "0" ]; then | ||
RET=1 | ||
fi | ||
|
@@ -131,19 +131,6 @@ if [ "$LINT" ]; then | |
fi | ||
echo "Check for non-standard imports DONE" | ||
|
||
echo "Check for use of lists instead of generators in built-in Python functions" | ||
|
||
# Example: Avoid `any([i for i in some_iterator])` in favor of `any(i for i in some_iterator)` | ||
# | ||
# Check the following functions: | ||
# any(), all(), sum(), max(), min(), list(), dict(), set(), frozenset(), tuple(), str.join() | ||
grep -R --include="*.py*" -E "[^_](any|all|sum|max|min|list|dict|set|frozenset|tuple|join)\(\[.* for .* in .*\]\)" pandas | ||
|
||
if [ $? = "0" ]; then | ||
RET=1 | ||
fi | ||
echo "Check for use of lists instead of generators in built-in Python functions DONE" | ||
|
||
echo "Check for incorrect sphinx directives" | ||
SPHINX_DIRECTIVES=$(echo \ | ||
"autosummary|contents|currentmodule|deprecated|function|image|"\ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ dependencies: | |
- fastparquet | ||
- feather-format | ||
- flake8=3.4.1 | ||
- flake8-comprehensions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need to add this to the dev deps as well |
||
- gcsfs | ||
- html5lib | ||
- ipython | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think need to run and commit scripts/convert_deps.py to have requirements_dev.txt updated. can you PR that?