@task
@needs('pavelib.prereqs.install_python_prereqs')
@timed
def run_safecommit_report():
 safecommit_script = 'safe-commit-linter.sh'
 safecommit_report_dir = (Env.REPORT_DIR / 'safecommit')
 safecommit_report = (safecommit_report_dir / 'safecommit.report')
 _prepare_report_dir(safecommit_report_dir)
 sh('{repo_root}/scripts/{safecommit_script} | tee {safecommit_report}'.format(repo_root=Env.REPO_ROOT, safecommit_script=safecommit_script, safecommit_report=safecommit_report), ignore_error=True)
 safecommit_count = _get_safecommit_count(safecommit_report)
 try:
  num_violations = int(safecommit_count)
 except TypeError:
  raise BuildFailure('Error. Number of {safecommit_script} violations could not be found in {safecommit_report}'.format(safecommit_script=safecommit_script, safecommit_report=safecommit_report))
 violations_count_str = 'Number of {safecommit_script} violations: {num_violations}\n'.format(safecommit_script=safecommit_script, num_violations=num_violations)
 metrics_report = (Env.METRICS_DIR / 'safecommit')
 _write_metric(violations_count_str, metrics_report)
 sh('cat {metrics_report}'.format(metrics_report=metrics_report), ignore_error=True)

@ task @ needs ( 'pavelib.prereqs.install_python_prereqs' ) @ timed def run_safecommit_report ( ) : safecommit_script = 'safe-commit-linter.sh' safecommit_report_dir = ( Env . REPORT_DIR / 'safecommit' ) safecommit_report = ( safecommit_report_dir / 'safecommit.report' ) _prepare_report_dir ( safecommit_report_dir ) sh ( '{repo_root}/scripts/{safecommit_script} | tee {safecommit_report}' . format ( repo_root = Env . REPO_ROOT , safecommit_script = safecommit_script , safecommit_report = safecommit_report ) , ignore_error = True ) safecommit_count = _get_safecommit_count ( safecommit_report ) try : num_violations = int ( safecommit_count ) except TypeError : raise BuildFailure ( 'Error. Number of {safecommit_script} violations could not be found in {safecommit_report}' . format ( safecommit_script = safecommit_script , safecommit_report = safecommit_report ) ) violations_count_str = 'Number of {safecommit_script} violations: {num_violations}\n' . format ( safecommit_script = safecommit_script , num_violations = num_violations ) metrics_report = ( Env . METRICS_DIR / 'safecommit' ) _write_metric ( violations_count_str , metrics_report ) sh ( 'cat {metrics_report}' . format ( metrics_report = metrics_report ) , ignore_error = True )
runs safe-commit-linter .