1
+ line-length = 120 # impacts import sorting
2
+
1
3
lint.extend-select = [
2
- " F" , # flakes rules -- default, but extend just in case
3
- " E" , # pycodestyle -- default, but extend just in case
4
- " W" , # various warnings
5
-
6
- " B" , # 'bugbear' set -- various possible bugs
7
- " C4" , # flake8-comprehensions -- unnecessary list/map/dict calls
8
- " COM" , # trailing commas
9
- " EXE" , # various checks wrt executable files
10
- " I" , # sort imports
11
- " ICN" , # various import conventions
12
- " FBT" , # detect use of boolean arguments
13
- " FURB" , # various rules
14
- " PERF" , # various potential performance speedups
15
- " PD" , # pandas rules
16
- " PIE" , # 'misc' lints
17
- " PLC" , # pylint convention rules
18
- " PLR" , # pylint refactor rules
19
- " PLW" , # pylint warnings
20
- " PT" , # pytest stuff
21
- " PYI" , # various type hinting rules
22
- " RET" , # early returns
23
- " RUF" , # various ruff-specific rules
24
- " TID" , # various imports suggestions
25
- " TRY" , # various exception handling rules
26
- " UP" , # detect deprecated python stdlib stuff
27
- " FA" , # suggest using from __future__ import annotations
28
- " PTH" , # pathlib migration
29
- " ARG" , # unused argument checks
30
- " A" , # builtin shadowing
31
- " G" , # logging stuff
32
-
33
- # "ALL", # uncomment this to check for new rules!
4
+ " ALL" ,
34
5
]
35
6
36
- # Preserve types, even if a file imports `from __future__ import annotations`
37
- # we need this for cachew to work with HPI types on 3.9
38
- # can probably remove after 3.10?
39
- lint.pyupgrade.keep-runtime-typing = true
40
-
41
7
lint.ignore = [
42
8
" D" , # annoying nags about docstrings
43
9
" N" , # pep naming
@@ -51,7 +17,6 @@ lint.ignore = [
51
17
52
18
# ## too opinionated style checks
53
19
" E501" , # too long lines
54
- " E702" , # Multiple statements on one line (semicolon)
55
20
" E731" , # assigning lambda instead of using def
56
21
" E741" , # Ambiguous variable name: `l`
57
22
" E742" , # Ambiguous class name: `O
@@ -66,9 +31,6 @@ lint.ignore = [
66
31
# # might be nice .. but later and I don't wanna make it strict
67
32
" E402" , # Module level import not at top of file
68
33
69
- " RUF100" , # unused noqa -- handle later
70
- " RUF012" , # mutable class attrs should be annotated with ClassVar... ugh pretty annoying for user configs
71
-
72
34
# ## these are just nitpicky, we usually know better
73
35
" PLR0911" , # too many return statements
74
36
" PLR0912" , # too many branches
@@ -83,10 +45,8 @@ lint.ignore = [
83
45
84
46
" B009" , # calling gettattr with constant attribute -- this is useful to convince mypy
85
47
" B010" , # same as above, but setattr
86
- " B011" , # complains about assert False
87
48
" B017" , # pytest.raises(Exception)
88
49
" B023" , # seems to result in false positives?
89
- " B028" , # suggest using explicit stacklevel? TODO double check later, but not sure it's useful
90
50
91
51
# complains about useless pass, but has sort of a false positive if the function has a docstring?
92
52
# this is common for click entrypoints (e.g. in __main__), so disable
@@ -106,44 +66,43 @@ lint.ignore = [
106
66
" PLW0603" , # global variable update.. we usually know why we are doing this
107
67
" PLW2901" , # for loop variable overwritten, usually this is intentional
108
68
109
- " PT011" , # pytest raises should is too broad
110
- " PT012" , # pytest raises should contain a single statement
69
+ " PT011" , # pytest raises is too broad
111
70
112
71
" COM812" , # trailing comma missing -- mostly just being annoying with long multiline strings
113
72
114
- " PD901" , # generic variable name df
115
-
116
73
" TRY003" , # suggests defining exception messages in exception class -- kinda annoying
117
- " TRY004" , # prefer TypeError -- don't see the point
118
74
" TRY201" , # raise without specifying exception name -- sometimes hurts readability
119
- " TRY400" , # TODO double check this, might be useful
75
+ " TRY400" , # a bit dumb, and results in false positives (see https://github.com/astral-sh/ruff/issues/18070)
120
76
" TRY401" , # redundant exception in logging.exception call? TODO double check, might result in excessive logging
121
77
122
- " PGH" , # TODO force error code in mypy instead? although it also has blanket noqa rule
123
-
124
78
" TID252" , # Prefer absolute imports over relative imports from parent modules
125
79
126
- " UP038" , # suggests using | (union) in isisntance checks.. but it results in slower code
127
-
128
80
# # too annoying
129
- " T20" , # just complains about prints and pprints
81
+ " T20" , # just complains about prints and pprints (TODO maybe consider later?)
130
82
" Q" , # flake quotes, too annoying
131
83
" C90" , # some complexity checking
132
84
" G004" , # logging statement uses f string
133
85
" ERA001" , # commented out code
134
86
" SLF001" , # private member accessed
135
87
" BLE001" , # do not catch 'blind' Exception
136
88
" INP001" , # complains about implicit namespace packages
137
- " SIM" , # some if statements crap
89
+ " SIM102" , # if statements collapsing, often hurts readability
90
+ " SIM103" , # multiple conditions collapsing, often hurts readability
91
+ " SIM105" , # suggests using contextlib.suppress instad of try/except -- this wouldn't be mypy friendly
92
+ " SIM108" , # suggests using ternary operation instead of if -- hurts readability
93
+ " SIM110" , # suggests using any(...) instead of for look/return -- hurts readability
94
+ " SIM117" , # suggests using single with statement instead of nested -- doesn't work in tests
138
95
" RSE102" , # complains about missing parens in exceptions
139
96
# #
140
97
141
98
" PLC0415" , # "imports should be at the top level" -- not realistic
142
99
" ARG001" , # ugh, kinda annoying when using pytest fixtures
143
100
" RUF001" , " RUF002" , " RUF003" , # spams about non-latin characters that we do use for testing
144
101
" A005" , # we're using promnesia.logging module
102
+ " B028" , # warnings stacklevel -- will fix later
145
103
]
146
104
105
+
147
106
extend-exclude = [
148
107
" tests/testdata/**" ,
149
108
]
0 commit comments