Skip to content

Instantly share code, notes, and snippets.

@dimitrov
Created March 9, 2015 14:05
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimitrov/7d9110dc164b16152fa8 to your computer and use it in GitHub Desktop.
Save dimitrov/7d9110dc164b16152fa8 to your computer and use it in GitHub Desktop.
Jenkins Warnings Plugin mapping script for flake8
import hudson.plugins.warnings.parser.Warning
import hudson.plugins.analysis.util.model.Priority
String fileName = matcher.group(1)
String type = matcher.group(4)
String lineNumber = matcher.group(2)
String message = matcher.group(5)
String typeCategory = String.valueOf(type.charAt(0));
String category
Priority priority = Priority.NORMAL
switch (typeCategory) {
case "E":
category = "PEP8 Errors"
priority = Priority.HIGH
break
case "W":
category = "PEP8 Warnings"
break
case "F":
category = "PyFlakes Warnings"
break
case "C":
category = "McCabe Warnings"
break
case "N":
category = "Naming Conventions Errors"
break
default:
category = "Unkown Warnings/Errors"
priority = Priority.LOW
}
return new Warning(fileName, Integer.parseInt(lineNumber), type, category, message, priority)
^(.*):([0-9]*):([0-9]*):\ (\w{4})\ (.*)$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment