from linter_adapters.common import BaseCategory, Severity
from linter_adapters.parser import BaseViolationParser


class Flake8DocstringsCategory(BaseCategory):
    MissingDocstrings       = 100
    WhitespaceIssues        = 200
    QuotesIssues            = 300
    DocstringContentIssues  = 400
    DocstringParsingError   = 900

@BaseViolationParser.register_decorator('D')
class Flake8DocstringsViolationParser(BaseViolationParser[Flake8DocstringsCategory]):
    ViolationCategory = Flake8DocstringsCategory
    provider_name = 'flake8-docstrings'
    severity_mapping = \
    {
        Flake8DocstringsCategory.MissingDocstrings:         Severity.Warning,
        Flake8DocstringsCategory.WhitespaceIssues:          Severity.Warning,
        Flake8DocstringsCategory.QuotesIssues:              Severity.Warning,
        Flake8DocstringsCategory.DocstringContentIssues:    Severity.Error,
        Flake8DocstringsCategory.DocstringParsingError:     Severity.Fatal,
    }
    default_severity = Severity.Warning


__all__ = \
[
    'Flake8DocstringsCategory',
    'Flake8DocstringsViolationParser',
]
