@task
@needs('pavelib.prereqs.install_python_prereqs')
@cmdopts([('system=', 's', 'System to act on')])
@timed
def run_pep8(options):
 (count, violations_list) = _get_pep8_violations()
 violations_list = ''.join(violations_list)
 violations_count_str = 'Number of pep8 violations: {count}'.format(count=count)
 print violations_count_str
 print violations_list
 with open((Env.METRICS_DIR / 'pep8'), 'w') as f:
  f.write((violations_count_str + '\n\n'))
  f.write(violations_list)
 if count:
  failure_string = ('Too many pep8 violations. ' + violations_count_str)
  failure_string += '\n\nViolations:\n{violations_list}'.format(violations_list=violations_list)
  raise BuildFailure(failure_string)

@ task @ needs ( 'pavelib.prereqs.install_python_prereqs' ) @ cmdopts ( [ ( 'system=' , 's' , 'System to act on' ) ] ) @ timed def run_pep8 ( options ) : ( count , violations_list ) = _get_pep8_violations ( ) violations_list = '' . join ( violations_list ) violations_count_str = 'Number of pep8 violations: {count}' . format ( count = count ) print violations_count_str print violations_list with open ( ( Env . METRICS_DIR / 'pep8' ) , 'w' ) as f : f . write ( ( violations_count_str + '\n\n' ) ) f . write ( violations_list ) if count : failure_string = ( 'Too many pep8 violations. ' + violations_count_str ) failure_string += '\n\nViolations:\n{violations_list}' . format ( violations_list = violations_list ) raise BuildFailure ( failure_string )
run pep8 on system code .