Skip to content

pep8 parser to log high severity fatal errors #59

@oppianmatt

Description

@oppianmatt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions