.ruff.toml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. exclude = [
  2. "migrations/*",
  3. ]
  4. line-length = 120
  5. [format]
  6. quote-style = "double"
  7. [lint]
  8. preview = false
  9. select = [
  10. "B", # flake8-bugbear rules
  11. "C4", # flake8-comprehensions
  12. "E", # pycodestyle E rules
  13. "F", # pyflakes rules
  14. "FURB", # refurb rules
  15. "I", # isort rules
  16. "N", # pep8-naming
  17. "PT", # flake8-pytest-style rules
  18. "PLC0208", # iteration-over-set
  19. "PLC0414", # useless-import-alias
  20. "PLE0604", # invalid-all-object
  21. "PLE0605", # invalid-all-format
  22. "PLR0402", # manual-from-import
  23. "PLR1711", # useless-return
  24. "PLR1714", # repeated-equality-comparison
  25. "RUF013", # implicit-optional
  26. "RUF019", # unnecessary-key-check
  27. "RUF100", # unused-noqa
  28. "RUF101", # redirected-noqa
  29. "RUF200", # invalid-pyproject-toml
  30. "RUF022", # unsorted-dunder-all
  31. "S506", # unsafe-yaml-load
  32. "SIM", # flake8-simplify rules
  33. "TRY400", # error-instead-of-exception
  34. "TRY401", # verbose-log-message
  35. "UP", # pyupgrade rules
  36. "W191", # tab-indentation
  37. "W605", # invalid-escape-sequence
  38. # security related linting rules
  39. # RCE proctection (sort of)
  40. "S102", # exec-builtin, disallow use of `exec`
  41. "S307", # suspicious-eval-usage, disallow use of `eval` and `ast.literal_eval`
  42. "S301", # suspicious-pickle-usage, disallow use of `pickle` and its wrappers.
  43. "S302", # suspicious-marshal-usage, disallow use of `marshal` module
  44. ]
  45. ignore = [
  46. "E402", # module-import-not-at-top-of-file
  47. "E711", # none-comparison
  48. "E712", # true-false-comparison
  49. "E721", # type-comparison
  50. "E722", # bare-except
  51. "F821", # undefined-name
  52. "F841", # unused-variable
  53. "FURB113", # repeated-append
  54. "FURB152", # math-constant
  55. "UP007", # non-pep604-annotation
  56. "UP032", # f-string
  57. "UP045", # non-pep604-annotation-optional
  58. "B005", # strip-with-multi-characters
  59. "B006", # mutable-argument-default
  60. "B007", # unused-loop-control-variable
  61. "B026", # star-arg-unpacking-after-keyword-arg
  62. "B903", # class-as-data-structure
  63. "B904", # raise-without-from-inside-except
  64. "B905", # zip-without-explicit-strict
  65. "N806", # non-lowercase-variable-in-function
  66. "N815", # mixed-case-variable-in-class-scope
  67. "PT011", # pytest-raises-too-broad
  68. "SIM102", # collapsible-if
  69. "SIM103", # needless-bool
  70. "SIM105", # suppressible-exception
  71. "SIM107", # return-in-try-except-finally
  72. "SIM108", # if-else-block-instead-of-if-exp
  73. "SIM113", # enumerate-for-loop
  74. "SIM117", # multiple-with-statements
  75. "SIM210", # if-expr-with-true-false
  76. ]
  77. [lint.per-file-ignores]
  78. "__init__.py" = [
  79. "F401", # unused-import
  80. "F811", # redefined-while-unused
  81. ]
  82. "configs/*" = [
  83. "N802", # invalid-function-name
  84. ]
  85. "libs/gmpy2_pkcs10aep_cipher.py" = [
  86. "N803", # invalid-argument-name
  87. ]
  88. "tests/*" = [
  89. "F811", # redefined-while-unused
  90. ]
  91. [lint.pyflakes]
  92. allowed-unused-imports = [
  93. "_pytest.monkeypatch",
  94. "tests.integration_tests",
  95. "tests.unit_tests",
  96. ]