Skip to content

Instantly share code, notes, and snippets.

@jvmccarthy
Last active August 29, 2015 13:56
Show Gist options
  • Save jvmccarthy/9119528 to your computer and use it in GitHub Desktop.
Save jvmccarthy/9119528 to your computer and use it in GitHub Desktop.
Jenkins Warnings Parser for ruby-lint

UI settings to define a Jenkins Warnings parser for ruby-lint

(in Manage Jenkins → Configure System)

Name, Link name, & Trend report name:

ruby-lint

Regular Expression:

^(.*):\s+((warning|error):\s+line\s+(\d+).*column\s+(\d+):.*)$

Mapping Script:

import hudson.plugins.warnings.parser.Warning
import hudson.plugins.analysis.util.model.Priority

String fileName = matcher.group(1)
String message = matcher.group(2)
String category = matcher.group(3)
String lineNumber = matcher.group(4)
String columnNumber = matcher.group(5)

priority = Priority.NORMAL
if(category.toLowerCase().equals("error")) {
  priority = Priority.HIGH
}

return new Warning(fileName, Integer.parseInt(lineNumber), "ruby-lint", category, message, priority)

Example Log Message:

ruby_lint_example.rb: warning: line 2, column 18: unused argument name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment