def lint_command(name, program, arguments, filter_regex, filename, lines):
output = utils.get_output_from_cache(name, filename)<EOL>if output is None:<EOL><INDENT>call_arguments = [program] + arguments + [filename]<EOL>try:<EOL><INDENT>output = subprocess.check_output(<EOL>call_arguments, stderr=subprocess.STDOUT)<EOL><DEDENT>except subprocess.CalledProcessError as error:<EOL><INDENT>output = error.output<EOL><DEDENT>except OSError:<EOL><INDENT>return {<EOL>filename: {<EOL>'<STR_LIT:error>': [('<STR_LIT>' +<EOL>'<STR_LIT>') %<EOL>('<STR_LIT:U+0020>'.join(call_arguments), os.linesep)]<EOL>}<EOL>}<EOL><DEDENT>output = output.decode('<STR_LIT:utf-8>')<EOL>utils.save_output_in_cache(name, filename, output)<EOL><DEDENT>output_lines = output.split(os.linesep)<EOL>if lines is None:<EOL><INDENT>lines_regex = r'<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>lines_regex = '<STR_LIT:|>'.join(map(str, lines))<EOL><DEDENT>lines_regex = '<STR_LIT>' % lines_regex<EOL>groups = ('<STR_LIT>', '<STR_LIT>', '<STR_LIT:message>', '<STR_LIT>', '<STR_LIT>')<EOL>filtered_lines = utils.filter_lines(<EOL>output_lines,<EOL>filter_regex.format(lines=lines_regex, filename=re.escape(filename)),<EOL>groups=groups)<EOL>result = []<EOL>for data in filtered_lines:<EOL><INDENT>comment = dict(p for p in zip(groups, data) if p[<NUM_LIT:1>] is not None)<EOL>if '<STR_LIT>' in comment:<EOL><INDENT>comment['<STR_LIT>'] = int(comment['<STR_LIT>'])<EOL><DEDENT>if '<STR_LIT>' in comment:<EOL><INDENT>comment['<STR_LIT>'] = int(comment['<STR_LIT>'])<EOL><DEDENT>if '<STR_LIT>' in comment:<EOL><INDENT>comment['<STR_LIT>'] = comment['<STR_LIT>'].title()<EOL><DEDENT>result.append(comment)<EOL><DEDENT>return {filename: {'<STR_LIT>': result}}<EOL>
Executes a lint program and filter the output.

    Executes the lint tool 'program' with arguments 'arguments' over the file
    'filename' returning only those lines matching the regular expression
    'filter_regex'.

    Args:
      name: string: the name of the linter.
      program: string: lint program.
      arguments: list[string]: extra arguments for the program.
      filter_regex: string: regular expression to filter lines.
      filename: string: filename to lint.
      lines: list[int]|None: list of lines that we want to capture. If None,
        then all lines will be captured.

    Returns: dict: a dict with the extracted info from the message.