The Groovy script works on the Matcher instance that is passed to the script in the variable matcher. The script must have a single return value of type edu.hm.hafner.analysis.Issue. Use the edu.hm.hafner.analysis.IssueBuilder instance that is passed to the script in the variable builder to create a new issue instance. Note that the return type of this script is Optional<Issue>, i.e. if a false positive has been detected, you must return Optional.empty(). Additional available variables:

fileName
the name of the parsed report file
lineNumber
the current line number

Example

Here is an example that you can use as a starting point for your script. It composes a new warning using the matcher of the regular expression ^\s*(.*):(\d+):(.*):\s*(.*)$.


import edu.hm.hafner.analysis.Severity

builder.setFileName(matcher.group(1))
        .setLineStart(Integer.parseInt(matcher.group(2)))
        .setSeverity(Severity.WARNING_NORMAL)
        .setCategory(matcher.group(3))
        .setMessage(matcher.group(4))

return builder.buildOptional();