jenkinsci/violations-plugin

pep8 parser to log high severity fatal errors

Opened this issue · 0 comments

Looking at the source of pep8 parser, seems to be only able to set med or low in severity.

    /**
     * Returns the Severity level as an int from the PEP 8 message type.
     *
     * The different message types are W for warning and E for error.
     * Because these are style guide warnings we set the severity
     * values lower than what the apparent values would be.
     *
     * @param messageType the type of PEP 8 message
     * @return an int is matched to the message type.
     */
    private void setServerityLevel(Violation violation, String messageType) {

        switch (messageType.charAt(0)) {
            case 'E':
                violation.setSeverity(Severity.MEDIUM);
                violation.setSeverityLevel(Severity.MEDIUM_VALUE);
                break;
            case 'W':
            default:
                violation.setSeverity(Severity.LOW);
                violation.setSeverityLevel(Severity.LOW_VALUE);
                break;
        }
    }

Would it be possible to add HIGH level for FATAL errors like:

foo/bar/utils.py:166:11: F821 undefined name 'foo'

So for ones that start with F, make them high.