|
| 1 | +exclude = ["docs/**"] |
| 2 | +line-length = 120 |
| 3 | + |
| 4 | +[format] |
| 5 | +quote-style = "double" |
| 6 | + |
| 7 | +[lint] |
| 8 | +preview = true |
| 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 | + # "T201", # print-found |
| 34 | + "TRY400", # error-instead-of-exception |
| 35 | + "TRY401", # verbose-log-message |
| 36 | + "UP", # pyupgrade rules |
| 37 | + "W191", # tab-indentation |
| 38 | + "W605", # invalid-escape-sequence |
| 39 | + "G001", # don't use str format to logging messages |
| 40 | + "G003", # don't use + in logging messages |
| 41 | + "G004", # don't use f-strings to format logging messages |
| 42 | + "UP042", # use StrEnum, |
| 43 | + "S110", # disallow the try-except-pass pattern. |
| 44 | + |
| 45 | + # security related linting rules |
| 46 | + # RCE proctection (sort of) |
| 47 | + "S102", # exec-builtin, disallow use of `exec` |
| 48 | + "S307", # suspicious-eval-usage, disallow use of `eval` and `ast.literal_eval` |
| 49 | + "S301", # suspicious-pickle-usage, disallow use of `pickle` and its wrappers. |
| 50 | + "S302", # suspicious-marshal-usage, disallow use of `marshal` module |
| 51 | + "S311", # suspicious-non-cryptographic-random-usage, |
| 52 | + |
| 53 | +] |
| 54 | + |
| 55 | +ignore = [ |
| 56 | + "E402", # module-import-not-at-top-of-file |
| 57 | + "E711", # none-comparison |
| 58 | + "E712", # true-false-comparison |
| 59 | + "E721", # type-comparison |
| 60 | + "E722", # bare-except |
| 61 | + "F821", # undefined-name |
| 62 | + "F841", # unused-variable |
| 63 | + "FURB113", # repeated-append |
| 64 | + "FURB152", # math-constant |
| 65 | + "UP007", # non-pep604-annotation |
| 66 | + "UP032", # f-string |
| 67 | + "UP045", # non-pep604-annotation-optional |
| 68 | + "B005", # strip-with-multi-characters |
| 69 | + "B006", # mutable-argument-default |
| 70 | + "B007", # unused-loop-control-variable |
| 71 | + "B026", # star-arg-unpacking-after-keyword-arg |
| 72 | + "B901", # allow return in yield |
| 73 | + "B903", # class-as-data-structure |
| 74 | + "B904", # raise-without-from-inside-except |
| 75 | + "B905", # zip-without-explicit-strict |
| 76 | + "N806", # non-lowercase-variable-in-function |
| 77 | + "N815", # mixed-case-variable-in-class-scope |
| 78 | + "PT011", # pytest-raises-too-broad |
| 79 | + "SIM102", # collapsible-if |
| 80 | + "SIM103", # needless-bool |
| 81 | + "SIM105", # suppressible-exception |
| 82 | + "SIM107", # return-in-try-except-finally |
| 83 | + "SIM108", # if-else-block-instead-of-if-exp |
| 84 | + "SIM113", # enumerate-for-loop |
| 85 | + "SIM117", # multiple-with-statements |
| 86 | + "SIM210", # if-expr-with-true-false |
| 87 | +] |
| 88 | + |
| 89 | +[lint.per-file-ignores] |
| 90 | +"__init__.py" = [ |
| 91 | + "F403", # allow re-export via star imports in packages |
| 92 | + "F401", # unused-import |
| 93 | + "F811", # redefined-while-unused |
| 94 | +] |
| 95 | +"configs/*" = [ |
| 96 | + "N802", # invalid-function-name |
| 97 | +] |
| 98 | + |
| 99 | +"tests/*" = [ |
| 100 | + "F811", # redefined-while-unused |
| 101 | + "T201", # allow print in tests, |
| 102 | + "S110", # allow ignoring exceptions in tests code (currently) |
| 103 | + "S311", # random is fine in tests |
| 104 | + |
| 105 | +] |
| 106 | + |
| 107 | +"src/ghoshell_moss/core/ctml/token_parser.py" = [ |
| 108 | + "N802", # SAX handler method names are fixed by the protocol |
| 109 | + "N818", # exception names are part of public API |
| 110 | +] |
| 111 | + |
| 112 | +"src/ghoshell_moss/core/duplex/connection.py" = [ |
| 113 | + "N818", # exception names are part of public API |
| 114 | +] |
| 115 | + |
| 116 | +[lint.pyflakes] |
| 117 | +allowed-unused-imports = [ |
| 118 | + "_pytest.monkeypatch", |
| 119 | + "tests.integration_tests", |
| 120 | + "tests.unit_tests", |
| 121 | +] |
0 commit comments