I think you may need to use descriptor def warningDesc = Jenkins.getInstance().getDescriptor(hudson.plugins.warnings.WarningsPublisher)
and then add the parser with it: warningDesc.addGroovyParser(RuboCop) Although I'm not 100% sure :) let me know when if you try that On Wednesday, March 22, 2017 at 6:39:18 PM UTC+1, Alex wrote: > > Hello, > > 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 > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4bf04008-399a-41f8-9ab5-5e60068bf736%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
