Skip to content
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

[SPARK-25270] lint-python: Add flake8 to find syntax errors and undefined names #22266

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions dev/lint-python
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,23 @@ else
rm "$PYCODESTYLE_REPORT_PATH"
fi

# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E901,E999,F821,F822,F823 --max-line-length=100 --show-source --statistics
flake8_status="${PIPESTATUS[0]}"

if [ "$flake8_status" -eq 0 ]; then
lint_status=0
else
lint_status=1
fi

if [ "$lint_status" -ne 0 ]; then
echo "flake8 checks failed."
exit "$lint_status"
else
echo "flake8 checks passed."
fi

# Check that the documentation builds acceptably, skip check if sphinx is not installed.
if hash "$SPHINXBUILD" 2> /dev/null; then
cd python/docs
Expand Down
1 change: 1 addition & 0 deletions dev/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
flake8==3.5.0
jira==1.0.3
PyGithub==1.26.0
Unidecode==0.04.19
Expand Down