Class AnsibleLintParser

  • All Implemented Interfaces:
    Serializable

    public class AnsibleLintParser
    extends LookaheadParser
    A parser for Ansible Lint warnings.

    The parser expects the Ansible Lint output to be in a "parseable output in the format of pep8". Pass the argument -p to Ansible Lint to get a compatible output.

    Author:
    Ce Qi
    See Also:
    Serialized Form
    • Constructor Detail

      • AnsibleLintParser

        public AnsibleLintParser()
        Creates a new instance of AnsibleLintParser.
    • Method Detail

      • isLineInteresting

        protected boolean isLineInteresting​(String line)
        Description copied from class: LookaheadParser
        Returns whether the specified line is interesting. Each interesting line will be matched by the defined regular expression. Here a parser can implement some fast checks (i.e. string or character comparisons) in order to see if a required condition is met. This default implementation does always return true.
        Overrides:
        isLineInteresting in class LookaheadParser
        Parameters:
        line - the line to inspect
        Returns:
        true if the line should be handed over to the regular expression scanner, false if the line does not contain a warning.
      • createIssue

        protected Optional<Issue> createIssue​(Matcher matcher,
                                              edu.hm.hafner.util.LookaheadStream lookahead,
                                              IssueBuilder builder)
        Description copied from class: LookaheadParser
        Creates a new issue for the specified pattern. This method is called for each matching line in the specified file. If a match is a false positive, then return Optional.empty() to ignore this warning.
        Specified by:
        createIssue in class LookaheadParser
        Parameters:
        matcher - the regular expression matcher
        lookahead - the lookahead stream to read additional lines
        builder - the issue builder to use
        Returns:
        a new annotation for the specified pattern