Enable developers to see pylint output

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 <lpabon@redhat.com>
Closes-Bug: #1356588
Signed-off-by: Luis Pabón <lpabon@redhat.com>
This commit is contained in:
Luis Pabón 2015-04-03 11:21:40 -04:00
parent a327dcfb50
commit 72d2840048
2 changed files with 26 additions and 0 deletions

View File

@ -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()

View File

@ -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:
#