107 lines
4.6 KiB
TOML
107 lines
4.6 KiB
TOML
target-version = "py38" # NOTE: inferred from pyproject.toml if present
|
|
|
|
lint.extend-select = [
|
|
"F", # flakes rules -- default, but extend just in case
|
|
"E", # pycodestyle -- default, but extend just in case
|
|
"W", # various warnings
|
|
|
|
"B", # 'bugbear' set -- various possible bugs
|
|
"C4", # flake8-comprehensions -- unnecessary list/map/dict calls
|
|
"COM", # trailing commas
|
|
"EXE", # various checks wrt executable files
|
|
"FBT", # detect use of boolean arguments
|
|
"FURB", # various rules
|
|
"PERF", # various potential performance speedups
|
|
"PIE", # 'misc' lints
|
|
"PLR", # 'refactor' rules
|
|
"PLW", # pylint warnings
|
|
"PT", # pytest stuff
|
|
"RET", # early returns
|
|
"RUF", # various ruff-specific rules
|
|
"UP", # detect deprecated python stdlib stuff
|
|
# "FA", # TODO enable later after we make sure cachew works?
|
|
# "PTH", # pathlib migration -- TODO enable later
|
|
# "ARG", # TODO useful, but results in some false positives in pytest fixtures... maybe later
|
|
# "A", # TODO builtin shadowing -- handle later
|
|
# "S", # bandit (security checks) -- tends to be not very useful, lots of nitpicks
|
|
# "DTZ", # datetimes checks -- complaining about missing tz and mostly false positives
|
|
# "EM", # TODO hmm could be helpful to prevent duplicate err msg in traceback.. but kinda annoying
|
|
# "FIX", # complains about fixmes/todos -- annoying
|
|
# "TD", # complains about todo formatting -- too annoying
|
|
# "ALL",
|
|
]
|
|
|
|
lint.ignore = [
|
|
### too opinionated style checks
|
|
"E501", # too long lines
|
|
"E702", # Multiple statements on one line (semicolon)
|
|
"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
|
|
|
|
### maybe consider these soon
|
|
# sometimes it's useful to give a variable a name even if we don't use it as a documentation
|
|
# on the other hand, often is a sign of error
|
|
"F841", # Local variable `count` is assigned to but never used
|
|
"F401", # imported but unused
|
|
###
|
|
|
|
### TODO should be fine to use these with from __future__ import annotations?
|
|
### there was some issue with cachew though... double check this?
|
|
"UP006", # use type instead of Type
|
|
"UP007", # use X | Y instead of Union
|
|
###
|
|
"RUF100", # unused noqa -- handle later
|
|
"RUF012", # mutable class attrs should be annotated with ClassVar... ugh pretty annoying for user configs
|
|
|
|
### 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
|
|
|
|
"PT004", # deprecated rule, will be removed later
|
|
"PT011", # pytest raises should is too broad
|
|
"PT012", # pytest raises should contain a single statement
|
|
|
|
"COM812", # trailing comma missing -- TODO maybe use this?
|
|
]
|