MCPcopy Create free account
hub / github.com/ActiveState/code / main

Function main

recipes/Python/546532_PyChecker_postprocessor/recipe-546532.py:523–549  ·  view source on GitHub ↗

Get a postprocessor, run the commands on the given arguments, split the output and return the number of non-OK'd warnings.

(args, cmds=_Cmds, OKd=_OKd, out=_Out, debug=_Debug,
               recursive=_Recursive, x3=_X3)

Source from the content-addressed store, hash-verified

521
522
523def main(args, cmds=_Cmds, OKd=_OKd, out=_Out, debug=_Debug,
524 recursive=_Recursive, x3=_X3):
525 '''Get a postprocessor, run the commands on the
526 given arguments, split the output and return
527 the number of non-OK'd warnings.
528 '''
529 m = n = 0
530 p = Processor(cmds, OKd, debug, out=out, x3=x3)
531 while args:
532 arg = args.pop(0)
533 if os.path.isdir(arg):
534 for d, ds, fs in os.walk(arg):
535 for f in fs:
536 if _Xpy and f.endswith(_Xpy):
537 pass # exclude
538 elif f.endswith('.py'):
539 f = os.path.join(d, f)
540 n += p.warnings(f)
541 m += 1
542 if recursive:
543 args.extend(ds)
544 else:
545 n += p.warnings(arg)
546 m += 1
547 if m != 1:
548 p.printf('%s%s total in %s', _NL, plural(n, 'error'), plural(m, 'module'))
549 return n # number of non-OK'd warnings
550
551
552if __name__ == '__main__':

Callers 1

recipe-546532.pyFile · 0.70

Calls 10

warningsMethod · 0.95
printfMethod · 0.95
pluralFunction · 0.85
isdirMethod · 0.80
endswithMethod · 0.80
ProcessorClass · 0.70
popMethod · 0.45
walkMethod · 0.45
joinMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected