def _initpep8(): # default pep8 setup pep8.options = _PEP8Options() pep8.options.physical_checks = pep8.find_checks('physical_line') pep8.options.logical_checks = pep8.find_checks('logical_line') pep8.options.counters = dict.fromkeys(pep8.BENCHMARK_KEYS, 0) pep8.options.messages = {} pep8.args = []
def pep8_check(filename): # default pep8 setup pep8.options = _PEP8Options() pep8.options.physical_checks = pep8.find_checks('physical_line') pep8.options.logical_checks = pep8.find_checks('logical_line') pep8.args = [] pep8.input_file(filename)
def _initpep8(): # default pep8 setup global pep8style if pep8style is None: pep8style = pep8.StyleGuide(config_file=True) pep8.options = _PEP8Options() pep8.options.physical_checks = pep8.find_checks('physical_line') pep8.options.logical_checks = pep8.find_checks('logical_line') pep8.options.counters = dict.fromkeys(pep8.BENCHMARK_KEYS, 0) pep8.options.messages = {} pep8.options.max_line_length = 79 pep8.args = []
def hg_hook(ui, repo, **kwargs): # default pep8 setup pep8.options = _PEP8Options() pep8.options.physical_checks = pep8.find_checks('physical_line') pep8.options.logical_checks = pep8.find_checks('logical_line') pep8.args = [] complexity = ui.configint('flake8', 'complexity', default=-1) warnings = 0 for file_ in _get_files(repo, **kwargs): warnings += check_file(file_, complexity) strict = ui.configbool('flake8', 'strict', default=True) if strict: return warnings return 0