in py_look_for_timeouts/main.py [0:0]
def main():
parser = argparse.ArgumentParser(
description='Look for python source files missing timeouts',
epilog=('Exit status is 0 if all files are okay, 1 if any files '
'have an error. Errors are printed to stdout')
)
parser.add_argument(
'--version',
action='version',
version='%(prog)s ' + __version__
)
parser.add_argument(
'--no-hardcoded',
action='store_true',
help="Do not allow hardcoded constant"
)
parser.add_argument('files', nargs='+', help='Files to check')
args = parser.parse_args()
errors = []
checker = Checker(allow_hardcoded=not args.no_hardcoded)
for fname in args.files:
these_errors = check(fname, checker=checker)
if these_errors:
print '\n'.join(str(e) for e in these_errors)
errors.extend(these_errors)
if errors:
print '%d total errors' % len(errors)
return 1
else:
return 0