Minor improvements to the Python linter (#12079)

* Mention utils/python_lint.py in docs/ContinuousIntegration.md

* Improve error messages in utils/python_lint.py

* Make python_lint.py fail if required modules are not found

Previously, it returned 0 in such a case, which is considered as a
successful exit.

* Continue returning success when missing modules [python_lint.py]

Reverts ffd3b7832f
This commit is contained in:
Manav Rathi
2017-09-24 08:53:54 +05:30
committed by Robert Widmann
parent 58e89b3fff
commit 82d6780383
2 changed files with 22 additions and 8 deletions

View File

@@ -23,8 +23,22 @@ def lint(arguments, verbose=True):
)
if flake8_result != 0:
if verbose:
print("Missing modules flake8 or flake8-import-order. Please be"
" sure to install these python packages before linting.")
print("""
The flake8 and flake8-import-order Python packages are required for linting,
but these were not found on your system.
You can install these using:
python -m pip install flake8
python -m pip install flake8-import-order
For more help, see http://flake8.pycqa.org.""")
# We should be returning `flake8_result` from here. However,
# some Python files lint themselves using embedded doctests,
# which causes CI smoke tests to fail because the Linux nodes
# do not have these modules installed.
return 0
utils_directory = os.path.dirname(os.path.abspath(__file__))