def _check_pep8(self): # Initialize pep8.options, which is necessary for # Checker.check_all() to execute. pep8.process_options(arglist=[self._file_path]) pep8_checker = pep8.Checker(self._file_path) def _pep8_handle_error(line_number, offset, text, check): # FIXME: Incorporate the character offset into the error output. # This will require updating the error handler __call__ # signature to include an optional "offset" parameter. pep8_code = text[:4] pep8_message = text[5:] category = "pep8/" + pep8_code self._handle_style_error(line_number, category, 5, pep8_message) pep8_checker.report_error = _pep8_handle_error pep8_checker.check_all()
def _check_pep8(self, lines): # Initialize pep8.options, which is necessary for # Checker.check_all() to execute. pep8.process_options(arglist=[self._file_path]) pep8_checker = pep8.Checker(self._file_path) def _pep8_handle_error(line_number, offset, text, check): # FIXME: Incorporate the character offset into the error output. # This will require updating the error handler __call__ # signature to include an optional "offset" parameter. pep8_code = text[:4] pep8_message = text[5:] category = "pep8/" + pep8_code self._handle_style_error(line_number, category, 5, pep8_message) pep8_checker.report_error = _pep8_handle_error pep8_errors = pep8_checker.check_all()