diff --git a/pavelib/quality.py b/pavelib/quality.py index 547bff0fc2..ca791d79be 100644 --- a/pavelib/quality.py +++ b/pavelib/quality.py @@ -143,7 +143,6 @@ def _count_pylint_violations(report_file): @needs('pavelib.prereqs.install_python_prereqs') @cmdopts([ ("system=", "s", "System to act on"), - ("limit=", "l", "limit for number of acceptable violations"), ]) def run_pep8(options): """ @@ -152,7 +151,6 @@ def run_pep8(options): """ num_violations = 0 systems = getattr(options, 'system', ALL_SYSTEMS).split(',') - violations_limit = int(getattr(options, 'limit', -1)) for system in systems: # Directory to put the pep8 report in. @@ -160,14 +158,19 @@ def run_pep8(options): report_dir = (Env.REPORT_DIR / system).makedirs_p() sh('pep8 {system} | tee {report_dir}/pep8.report'.format(system=system, report_dir=report_dir)) - num_violations = num_violations + _count_pep8_violations( + num_violations = num_violations + _ + + count = _count_pep8_violations( "{report_dir}/pep8.report".format(report_dir=report_dir)) - print("Number of pep8 violations: " + str(num_violations)) - # Fail the task if the violations limit has been reached - if num_violations > violations_limit > -1: - raise Exception("Failed. Too many pep8 violations. " - "The limit is {violations_limit}.".format(violations_limit=violations_limit)) + print("Number of pep8 violations: {count}".format(count=count)) + if count: + raise Exception( + "Too many pep8 violations. Number of violations found: {count}.".format( + count=count + ) + ) + def _count_pep8_violations(report_file):