Class GrepParser

java.lang.Object
io.jenkins.plugins.analysis.core.model.Tool
io.jenkins.plugins.analysis.warnings.GrepParser
All Implemented Interfaces:
Describable<Tool>, Serializable

public class GrepParser extends Tool
Provides a simple grep-style file scanner that searches for occurrences of a configurable regular expression in the workspace files and reports each matching line as an issue.
Author:
Akash Manna
See Also:
  • Constructor Details

    • GrepParser

      @DataBoundConstructor public GrepParser()
      Creates a new instance of GrepParser.
  • Method Details

    • getIncludePattern

      public String getIncludePattern()
      Returns the Ant file-set pattern of files to scan.
      Returns:
      Ant file-set pattern of files to scan
    • setIncludePattern

      @DataBoundSetter public void setIncludePattern(String includePattern)
      Sets the Ant file-set pattern of files to scan.
      Parameters:
      includePattern - Ant file-set pattern of files to scan
    • getExcludePattern

      public String getExcludePattern()
      Returns the Ant file-set pattern of files to exclude from scanning.
      Returns:
      Ant file-set pattern of files to exclude
    • setExcludePattern

      @DataBoundSetter public void setExcludePattern(String excludePattern)
      Sets the Ant file-set pattern of files to exclude from scanning.
      Parameters:
      excludePattern - Ant file-set pattern of files to exclude
    • getRegexp

      public String getRegexp()
      Returns the regular expression used to match lines.
      Returns:
      the regular expression
    • setRegexp

      @DataBoundSetter public void setRegexp(String regexp)
      Sets the regular expression used to match lines.
      Parameters:
      regexp - the regular expression
    • getMessage

      public String getMessage()
      Returns the optional message template for matched issues. When blank, the matched line is used as-is.
      Returns:
      the message template (may be empty)
    • setMessage

      @DataBoundSetter public void setMessage(String message)
      Sets an optional message template for matched issues.
      Parameters:
      message - the message template
    • getSeverity

      public String getSeverity()
      Returns the severity to assign to matched issues.
      Returns:
      the severity name (one of Severity.ERROR, Severity.WARNING_HIGH, Severity.WARNING_NORMAL, Severity.WARNING_LOW)
    • setSeverity

      @DataBoundSetter public void setSeverity(String severity)
      Sets the severity to assign to matched issues.
      Parameters:
      severity - the severity name
    • scan

      public edu.hm.hafner.analysis.Report scan(Run<?,?> run, FilePath workspace, Charset sourceCodeEncoding, io.jenkins.plugins.util.LogHandler logger)
      Description copied from class: Tool
      Scans the results of a build for issues. This method is invoked on Jenkins master. I.e., if a tool wants to process some build results, it is required to run a MasterToSlaveCallable.
      Specified by:
      scan in class Tool
      Parameters:
      run - the build
      workspace - the workspace of the build
      sourceCodeEncoding - the encoding to use to read source files
      logger - the logger
      Returns:
      the created report