def _process_main(self): if not self._loaded: # Windows needs to parse again the configuration from flake8.main import get_style_guide, DEFAULT_CONFIG get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG) for filename in iter(self.task_queue.get, 'DONE'): self.input_file(filename)
def _process_main(self): if not self._loaded: # Windows needs to parse again the configuration from flake8.main import get_style_guide get_style_guide(parse_argv=True) for filename in iter(self.task_queue.get, 'DONE'): self.input_file(filename)
def process_main(self): if not self._loaded: # Windows needs to parse again the configuration from flake8.main import get_style_guide, DEFAULT_CONFIG get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG) for filename in iter(self.task_queue.get, 'DONE'): self.input_file(filename) self.result_queue.put(self.get_state())
def process_main(self): if not self._loaded: # Windows needs to parse again the configuration from flake8.main import get_style_guide, DEFAULT_CONFIG get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG) try: for filename in iter(self.task_queue.get, 'DONE'): self.input_file(filename) except KeyboardInterrupt: pass finally: self.result_queue.put(self.get_state())
def runFlake8(target): import pep8 import flake8.main as flake8 # suppress dafault stdout errors from pep8.StandardReport class Pep8Report(pep8.StandardReport): def get_file_results(self): return self.file_errors flake8_style = flake8.get_style_guide(paths=[target], verbose=1, reporter=Pep8Report) report = flake8_style.check_files() errors = [] # the actual errors is store in `_deferred_print` for line_number, offset, code, text, doc in report._deferred_print: errors.append({ 'path': report.filename, 'row': report.line_offset + line_number, 'col': offset + 1, 'code': code, 'text': text, }) return errors
# -*- coding: utf-8 -*-
def check_code(code, filename, **kwargs): flake8_style = flake8.get_style_guide(**kwargs) flake8_style.options.report = QuietReport(flake8_style.options) if flake8_style.excluded(filename): return [] return flake8_style.input_file(None, lines=code.splitlines(True))