line-length = 120 # impacts import sorting lint.extend-select = [ "ALL", ] # Preserve types, even if a file imports `from __future__ import annotations` # we need this for cachew to work with HPI types on 3.9 # can probably remove after 3.10? lint.pyupgrade.keep-runtime-typing = true lint.ignore = [ "D", # annoying nags about docstrings "N", # pep naming "TCH", # type checking rules, mostly just suggests moving imports under TYPE_CHECKING "S", # bandit (security checks) -- tends to be not very useful, lots of nitpicks "DTZ", # datetimes checks -- complaining about missing tz and mostly false positives "FIX", # complains about fixmes/todos -- annoying "TD", # complains about todo formatting -- too annoying "ANN", # missing type annotations? seems way to strict though "EM" , # suggests assigning all exception messages into a variable first... pretty annoying ### too opinionated style checks "E501", # too long lines "E731", # assigning lambda instead of using def "E741", # Ambiguous variable name: `l` "E742", # Ambiguous class name: `O "E401", # Multiple imports on one line "F403", # import *` used; unable to detect undefined names ### ### "E722", # Do not use bare `except` ## Sometimes it's useful for defensive imports and that sort of thing.. "F811", # Redefinition of unused # this gets in the way of pytest fixtures (e.g. in cachew) ## might be nice .. but later and I don't wanna make it strict "E402", # Module level import not at top of file ### these are just nitpicky, we usually know better "PLR0911", # too many return statements "PLR0912", # too many branches "PLR0913", # too many function arguments "PLR0915", # too many statements "PLR1714", # consider merging multiple comparisons "PLR2044", # line with empty comment "PLR5501", # use elif instead of else if "PLR2004", # magic value in comparison -- super annoying in tests ### "PLR0402", # import X.Y as Y -- TODO maybe consider enabling it, but double check "B009", # calling gettattr with constant attribute -- this is useful to convince mypy "B010", # same as above, but setattr "B017", # pytest.raises(Exception) "B023", # seems to result in false positives? # complains about useless pass, but has sort of a false positive if the function has a docstring? # this is common for click entrypoints (e.g. in __main__), so disable "PIE790", # a bit too annoying, offers to convert for loops to list comprehension # , which may heart readability "PERF401", # suggests no using exception in for loops # we do use this technique a lot, plus in 3.11 happy path exception handling is "zero-cost" "PERF203", "RET504", # unnecessary assignment before returning -- that can be useful for readability "RET505", # unnecessary else after return -- can hurt readability "PLW0603", # global variable update.. we usually know why we are doing this "PLW2901", # for loop variable overwritten, usually this is intentional "PT011", # pytest raises is too broad "COM812", # trailing comma missing -- mostly just being annoying with long multiline strings "TRY003", # suggests defining exception messages in exception class -- kinda annoying "TRY201", # raise without specifying exception name -- sometimes hurts readability "TRY400", # a bit dumb, and results in false positives (see https://github.com/astral-sh/ruff/issues/18070) "TRY401", # redundant exception in logging.exception call? TODO double check, might result in excessive logging "TID252", # Prefer absolute imports over relative imports from parent modules ## too annoying "T20", # just complains about prints and pprints (TODO maybe consider later?) "Q", # flake quotes, too annoying "C90", # some complexity checking "G004", # logging statement uses f string "ERA001", # commented out code "SLF001", # private member accessed "BLE001", # do not catch 'blind' Exception "INP001", # complains about implicit namespace packages "SIM102", # if statements collapsing, often hurts readability "SIM103", # multiple conditions collapsing, often hurts readability "SIM105", # suggests using contextlib.suppress instad of try/except -- this wouldn't be mypy friendly "SIM108", # suggests using ternary operation instead of if -- hurts readability "SIM110", # suggests using any(...) instead of for look/return -- hurts readability "SIM117", # suggests using single with statement instead of nested -- doesn't work in tests "RSE102", # complains about missing parens in exceptions ## ]