exclude = [
    "migrations/*",
    ".git",
    ".git/**",
]
line-length = 120

[format]
quote-style = "double"

[lint]
preview = true
select = [
    "B",       # flake8-bugbear rules
    "C4",      # flake8-comprehensions
    "E",       # pycodestyle E rules
    "F",       # pyflakes rules
    "FURB",    # refurb rules
    "I",       # isort rules
    "N",       # pep8-naming
    "PT",      # flake8-pytest-style rules
    "PLC0208", # iteration-over-set
    "PLC0414", # useless-import-alias
    "PLE0604", # invalid-all-object
    "PLE0605", # invalid-all-format
    "PLR0402", # manual-from-import
    "PLR1711", # useless-return
    "PLR1714", # repeated-equality-comparison
    "RUF013",  # implicit-optional
    "RUF019",  # unnecessary-key-check
    "RUF100",  # unused-noqa
    "RUF101",  # redirected-noqa
    "RUF200",  # invalid-pyproject-toml
    "RUF022",  # unsorted-dunder-all
    "S506",    # unsafe-yaml-load
    "SIM",     # flake8-simplify rules
    "T201",    # print-found
    "TRY400",  # error-instead-of-exception
    "TRY401",  # verbose-log-message
    "UP",      # pyupgrade rules
    "W191",    # tab-indentation
    "W605",    # invalid-escape-sequence
    "G001",    # don't use str format to logging messages
    "G003",    # don't use + in logging messages
    "G004",    # don't use f-strings to format logging messages
    "UP042",   # use StrEnum,
    "S110",    # disallow the try-except-pass pattern.

    # security related linting rules
    # RCE proctection (sort of)
    "S102", # exec-builtin, disallow use of `exec`
    "S307", # suspicious-eval-usage, disallow use of `eval` and `ast.literal_eval`
    "S301", # suspicious-pickle-usage, disallow use of `pickle` and its wrappers.
    "S302", # suspicious-marshal-usage, disallow use of `marshal` module
    "S311", # suspicious-non-cryptographic-random-usage,
    "TID",   # flake8-tidy-imports

]

ignore = [
    "E402",    # module-import-not-at-top-of-file
    "E711",    # none-comparison
    "E712",    # true-false-comparison
    "E721",    # type-comparison
    "E722",    # bare-except
    "F821",    # undefined-name
    "F841",    # unused-variable
    "FURB113", # repeated-append
    "FURB152", # math-constant
    "UP007",   # non-pep604-annotation
    "UP032",   # f-string
    "B006",    # mutable-argument-default
    "B007",    # unused-loop-control-variable
    "B026",    # star-arg-unpacking-after-keyword-arg
    "B901",    # allow return in yield
    "B903",    # class-as-data-structure
    "B904",    # raise-without-from-inside-except
    "B905",    # zip-without-explicit-strict
    "N806",    # non-lowercase-variable-in-function
    "N815",    # mixed-case-variable-in-class-scope
    "PT011",   # pytest-raises-too-broad
    "SIM102",  # collapsible-if
    "SIM103",  # needless-bool
    "SIM105",  # suppressible-exception
    "SIM108",  # if-else-block-instead-of-if-exp
    "SIM113",  # enumerate-for-loop
    "SIM117",  # multiple-with-statements
    "SIM210",  # if-expr-with-true-false
    "TID252",  # allow relative imports from parent modules
]

[lint.per-file-ignores]
"configs/*" = [
    "N802", # invalid-function-name
]
"libs/gmpy2_pkcs10aep_cipher.py" = [
    "N803", # invalid-argument-name
]
"tests/*" = [
    "T201", # allow print in tests,
    "S110", # allow ignoring exceptions in tests code (currently)
]

[lint.flake8-tidy-imports.banned-api."flask_restx.reqparse"]
msg = "Use Pydantic payload/query models instead of reqparse."

[lint.flake8-tidy-imports.banned-api."flask_restx.reqparse.RequestParser"]
msg = "Use Pydantic payload/query models instead of reqparse."

[lint.isort]
known-first-party = ["graphon"]