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 Optional<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 method buildOptional() creates an
Optional with a wrapped Issue instance, you rarely need to call the
build() method that directly creates an Issue. If a false positive has been detected
by the regular expression, you must return Optional.empty().
Additional available variables:
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();