package hudson.plugins.warnings.parser;

import java.util.regex.Matcher;

import hudson.Extension;

/**
 * A parser for the PyLint compiler warnings.
 *
 * @author Sebastian Hansbauer
 */
@Extension
public class PyLintParser extends RegexpLineParser {
    private static final long serialVersionUID = 4464053085862883240L;

    private static final String PYLINT_ERROR_PATTERN = "(.*):(\\d+): \\[(\\D\\d*).*\\] (.*)";

    /**
     * Creates a new instance of {@link PyLintParser}.
     */
    public PyLintParser() {
        super(Messages._Warnings_PyLint_ParserName(),
                Messages._Warnings_PyLint_LinkName(),
                Messages._Warnings_PyLint_TrendName(),
                PYLINT_ERROR_PATTERN, true);
    }

    @Override
    protected boolean isLineInteresting(final String line) {
        return line.contains("[");
    }

    @Override
    protected Warning createWarning(final Matcher matcher) {
        String message = matcher.group(4);
        String category = classifyIfEmpty(matcher.group(3), message);

        return createWarning(matcher.group(1), getLineNumber(matcher.group(2)), category, message);
    }
}

@@ -63,24 +63,77 @@
 x.Matcher;%0A%0A
+import hudson.plugins.analysis.util.model.Priority;%0A%0A
 import hudso
@@ -1084,16 +1084,305 @@
 ssage);%0A
+        //First letter of the Pylint classification is one of F/E/W/R/C. E/F/W are high priority.%0A        Priority priority = Priority.NORMAL;%0A        if (category.contains('E') %7C%7C category.contains('F') %7C%7C category.contains('W')) %7B%0A            priority = Priority.HIGH;%0A        %7D%0A        
 %0A       
@@ -1467,23 +1467,33 @@
 ory, message
+, priority
 );%0A    %7D%0A%7D%0A

Add priorities to PylintParser