I am trying to automate the creation of a parser for the warnings plugin.
So far I have this groovy code
import hudson.plugins.warnings.*;
def rubocop_name = 'Rubocop';
def rubocop_regexp = "^([^:]+):(\\d+):\\d+: ([^:]): ([^:]+)\$";
def rubocop_script = '''
import hudson.plugins.warnings.parser.Warning
String fileName = matcher.group(1)
String lineNumber = matcher.group(2)
String category = matcher.group(3)
String message = matcher.group(4)
return new Warning(fileName, Integer.parseInt(lineNumber), "Ruby Lint Warnings", category, message);
'''
def rubocop_example = "'attributes/default.rb:21:78: C: Use %r only for regular expressions matching more than 1 '/' character.'";
def rubocop_link = 'RuboCop';
def rubocop_trend = 'Ruby Lint Warnings';
def RuboCop = new GroovyParser (
rubocop_name,
rubocop_regexp,
rubocop_script,
rubocop_example,
rubocop_link,
rubocop_trend
)
I couldn't find a method that saves this and makes this visibile in Configure Jenkins -> Compiler Warnings.
Thanks