def lint_files(self, files): command = self.create_command(files) _, output = run_command(command, cwd=self.working_dir) if not output: raise StopIteration() problems = parse_checkstyle(output) for filename, line, message in problems: yield Problem(self._relativize_filename(filename), line, message, self.name)
def lint_files(self, files): command = [self.python_name, '-m', 'pep8'] command += files _, output = run_command(command, split=True, cwd=self.working_dir) if not output: raise StopIteration() for line in output: filename, line, message = self._parse_line(line) yield Problem(filename, line, message, self.name)
def lint_files(self, files): command = ['yamllint', '-f', 'parsable'] command += files _, output = run_command(command, split=True, cwd=self.working_dir) if not output: raise StopIteration() for line in output: filename, line, message = self._parse_line(line) is_error = not message.startswith('[warning]') yield Problem(filename, line, message, self.name, is_error)
def lint_files(self, files): for file in files: command = self.create_command(file) _, output = run_command(command, split=True, include_errors=True, cwd=self.working_dir) if not output: continue for line in output: parsed = self._parse_line(line) if not parsed: continue filename, line, message = parsed yield Problem(filename, line, message, self.name)
def lint_files(self, files): command = self.create_command(files) _, output = run_command(command, cwd=self.working_dir) if not output: raise StopIteration() try: problems = json.loads(output) except ValueError: raise StopIteration() for source in problems: for problem in source['warnings']: yield Problem(self._relativize_filename(source['source']), problem['line'], problem['text'], self.name)
def lint_files(self, files): config = self._read_flake8_config() import_order_style = config.get('import-order-style', 'pep8') command = [ self.python_name, '-m', 'flake8', '--import-order-style', import_order_style, '--filename', '*.py*' ] command += files _, output = run_command(command, split=True, cwd=self.working_dir) if not output: raise StopIteration() for line in output: filename, line, message = self._parse_line(line) yield Problem(filename, line, message, self.name)
def lint_files(self, files): command = ['bandit', '-f', 'csv'] ini_conf = os.path.join(self.working_dir, '.bandit') if os.path.exists(ini_conf): command.extend(['--ini', '.bandit']) command += files _, output = run_command(command, cwd=self.working_dir) if not output: raise StopIteration() reader = csv.DictReader(six.StringIO(output)) for row in reader: msg = '[{}] {}'.format(row['test_name'], row['issue_text']) is_error = row['issue_severity'] != 'LOW' yield Problem(row['filename'], int(row['line_number']), msg, self.name, is_error)
def lint_files(self, files): command = [ self.python_name, '-m', 'pylint', '-r', 'n', '-f', 'parseable' ] command += files _, output = run_command(command, split=True, include_errors=True, cwd=self.working_dir) if not output: raise StopIteration() for line in output: parsed = self._parse_line(to_text(line)) if parsed is None: continue filename, line, message = parsed yield Problem(filename, line, message, self.name)