示例#1
0
文件: main.py 项目: gfreezy/flake8
def check_file(path, ignore=(), complexity=-1):
    if pep8style.excluded(path):
        return 0
    warning = flakey.check_path(path)
    _set_alt(warning)
    warnings = flakey.print_messages(warning, ignore=ignore)
    warnings += pep8style.input_file(path)
    if complexity > -1:
        warnings += mccabe.get_module_complexity(path, complexity)
    return warnings
示例#2
0
    def run(self):
        import flakey

        build_py_command = self.get_finalized_command('build_py')
        error_count = 0
        for (_, _, path) in build_py_command.find_all_modules():
            warning = flakey.check_path(path)
            if isinstance(warning, flakey.checker.Checker):
                error_count += flakey.print_messages(warning)
            else:
                raise ValueError("Unexpected check_path result.")

        if error_count:
            raise SystemExit(os.EX_DATAERR)