Simplify reporting and execution of pep8.
We are not using the limit flag in the actual run_pep8 method; removing that from scripts. Operationally, pep8 has been enforcing a limit of zero for awhile; this finishes that realization. Also, all pep8 reports now appear under the reports/pep8 folder, rather than per-system.
This commit is contained in:
@@ -146,22 +146,21 @@ def _count_pylint_violations(report_file):
|
||||
])
|
||||
def run_pep8(options):
|
||||
"""
|
||||
Run pep8 on system code. When violations limit is passed in,
|
||||
fail the task if too many violations are found.
|
||||
Run pep8 on system code.
|
||||
Fail the task if any violations are found.
|
||||
"""
|
||||
num_violations = 0
|
||||
systems = getattr(options, 'system', ALL_SYSTEMS).split(',')
|
||||
|
||||
for system in systems:
|
||||
# Directory to put the pep8 report in.
|
||||
# This makes the folder if it doesn't already exist.
|
||||
report_dir = (Env.REPORT_DIR / system).makedirs_p()
|
||||
report_dir = (Env.REPORT_DIR / 'pep8')
|
||||
report_dir.rmtree(ignore_errors=True)
|
||||
report_dir.makedirs_p()
|
||||
|
||||
sh('pep8 {system} | tee {report_dir}/pep8.report'.format(system=system, report_dir=report_dir))
|
||||
num_violations = num_violations + _
|
||||
for system in systems:
|
||||
sh('pep8 {system} | tee {report_dir}/pep8.report -a'.format(system=system, report_dir=report_dir))
|
||||
|
||||
count = _count_pep8_violations(
|
||||
"{report_dir}/pep8.report".format(report_dir=report_dir))
|
||||
"{report_dir}/pep8.report".format(report_dir=report_dir)
|
||||
)
|
||||
|
||||
print("Number of pep8 violations: {count}".format(count=count))
|
||||
if count:
|
||||
@@ -172,7 +171,6 @@ def run_pep8(options):
|
||||
)
|
||||
|
||||
|
||||
|
||||
def _count_pep8_violations(report_file):
|
||||
num_lines = sum(1 for line in open(report_file))
|
||||
return num_lines
|
||||
|
||||
@@ -62,7 +62,6 @@ source scripts/jenkins-common.sh
|
||||
|
||||
# Violations thresholds for failing the build
|
||||
PYLINT_THRESHOLD=6000
|
||||
PEP8_THRESHOLD=0
|
||||
|
||||
# If the environment variable 'SHARD' is not set, default to 'all'.
|
||||
# This could happen if you are trying to use this script from
|
||||
@@ -75,7 +74,7 @@ case "$TEST_SUITE" in
|
||||
|
||||
"quality")
|
||||
paver find_fixme > fixme.log || { cat fixme.log; EXIT=1; }
|
||||
paver run_pep8 -l $PEP8_THRESHOLD > pep8.log || { cat pep8.log; EXIT=1; }
|
||||
paver run_pep8 > pep8.log || { cat pep8.log; EXIT=1; }
|
||||
paver run_pylint -l $PYLINT_THRESHOLD > pylint.log || { cat pylint.log; EXIT=1; }
|
||||
# Run quality task. Pass in the 'fail-under' percentage to diff-quality
|
||||
paver run_quality -p 100
|
||||
|
||||
Reference in New Issue
Block a user