Skip to content

Instantly share code, notes, and snippets.

@paul-butcher
Created November 29, 2018 12:39
Show Gist options
  • Save paul-butcher/ed73b21c18ab081fbf8f751986e31956 to your computer and use it in GitHub Desktop.
Save paul-butcher/ed73b21c18ab081fbf8f751986e31956 to your computer and use it in GitHub Desktop.
Radon CC warnings plugin
myproj/myfile.py
M 185:4 MyClass.my_method - C (12)
import hudson.plugins.warnings.parser.Warning
String filename = matcher.group(1)
String line = matcher.group(2)
gradeMap = [A:'low - simple block',
B:'low - well structured and stable block',
C:'moderate - slightly complex block',
D:'more than moderate - more complex block',
E:'high - complex block, alarming',
F:'very high - error-prone, unstable block']
String message = gradeMap.get(matcher.group(4))+ " " + matcher.group(4) + " " + matcher.group(5)
return new Warning(filename, Integer.parseInt(line), 'complexity', 'complexity', message);
(.*)\n\W+.\W(\d+):\d+\W(.*) - (A|B|C|D|E|F) (.*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment