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


class Flake8BanditCategory(BaseCategory):
    TestCode            = 100
    Misconfiguration    = 200
    BadCalls            = 300
    BadImports          = 400
    Cryptography        = 500
    Injection           = 600
    XSS                 = 700

@BaseViolationParser.register_decorator('S')
class Flake8BanditViolationParser(BaseViolationParser[Flake8BanditCategory]):
    ViolationCategory = Flake8BanditCategory
    provider_name = 'flake8-bandit'
    severity_mapping = \
    {
        Flake8BanditCategory.TestCode:         Severity.Error,
        Flake8BanditCategory.Misconfiguration: Severity.Error,
        Flake8BanditCategory.BadCalls:         Severity.Error,
        Flake8BanditCategory.BadImports:       Severity.Error,
        Flake8BanditCategory.Cryptography:     Severity.Error,
        Flake8BanditCategory.Injection:        Severity.Error,
        Flake8BanditCategory.XSS:              Severity.Error,
    }
    default_severity = Severity.Error


__all__ = \
[
    'Flake8BanditCategory',
    'Flake8BanditViolationParser',
]
