Created
March 9, 2015 14:05
-
-
Save dimitrov/7d9110dc164b16152fa8 to your computer and use it in GitHub Desktop.
Jenkins Warnings Plugin mapping script for flake8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^(.*):([0-9]*):([0-9]*):\ (\w{4})\ (.*)$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment