From 72d2840048c6aba344ea9ba08f301ef5dc5226a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pab=C3=B3n?= Date: Fri, 3 Apr 2015 11:21:40 -0400 Subject: [PATCH] Enable developers to see pylint output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The program tools/lintstack.py which is executed by tools/lintstack.sh when Jenkins runs, only tests for differences in the output of pylint. Right now, there seems to be 17 errors/warnings that are being carried over from fix to fix, with no difference between fixes, and so no failures in the pylint Jenkins job. It is really difficult to tell what the errors are, so this fix allows developers determine what the errors are by running the following command: $ tox -e lint A sample output of the command is available as an attachment to the bug. Change-Id: I88487829576d55d437b934e08571013b7a6e57cf Signed-off-by: Luis Pabón Closes-Bug: #1356588 Signed-off-by: Luis Pabón --- tools/lintstack.py | 21 +++++++++++++++++++++ tox.ini | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/tools/lintstack.py b/tools/lintstack.py index 91d7b83513..2613a7e976 100755 --- a/tools/lintstack.py +++ b/tools/lintstack.py @@ -151,6 +151,25 @@ def generate_error_keys(msg=None): ErrorKeys.print_json(errors, output=f) +def check(): + print("Running pylint. Be patient...") + newmsg = run_pylint() + errors = LintOutput.from_msg_to_dict(newmsg) + + passed = True + for err_key, err_list in errors.items(): + for err in err_list: + print(err.review_str() + "\n") + passed = False + + if passed: + print("Congrats! pylint check passed.") + else: + print("\nPlease fix the errors above. If you believe they are false " + "positives, run 'tools/lintstack.py generate' to overwrite.") + sys.exit(1) + + def validate(newmsg=None): print("Loading", KNOWN_PYLINT_EXCEPTIONS_FILE) known = ErrorKeys.from_file(KNOWN_PYLINT_EXCEPTIONS_FILE) @@ -197,6 +216,8 @@ def main(): generate_error_keys() elif option == "validate": validate() + elif option == "check": + check() else: usage() diff --git a/tox.ini b/tox.ini index 2e57c15325..8901d3187a 100644 --- a/tox.ini +++ b/tox.ini @@ -50,6 +50,11 @@ deps = -r{toxinidir}/requirements.txt whitelist_externals = bash commands = bash tools/lintstack.sh +[testenv:lint] +deps = -r{toxinidir}/requirements.txt + pylint==0.26.0 +commands = python tools/lintstack.py check + [flake8] # Following checks are ignored on purpose: #