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:
parent
a327dcfb50
commit
72d2840048
@ -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()
|
||||
|
||||
|
5
tox.ini
5
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:
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user