-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
222 lines (197 loc) · 8.37 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
[tool.black]
# I use ruff over it
line-length = 120
target-version = ["py312"]
[tool.isort]
# I use ruff over it
profile = "black"
combine_as_imports = true
combine_star = true
line_length = 120
[tool.pyright]
pythonVersion = "3.12"
typeCheckingMode = "strict" # let's enable the default max setting and go down from here.
exclude = ["**/__pycache__"]
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md
deprecateTypingAliases = true
reportMissingTypeStubs = "none" # a lot of libs don't have stubs
reportPrivateUsage = "none" # it's my choice
reportImplicitOverride = "warning" # I love it
# Unnecessary
reportUnnecessaryIsInstance = "none" # I like "else" raising the error if type is somehow not it
reportUnnecessaryTypeIgnoreComment = "warning" # why it's "none" by default, even for strict ?!
# Unused stuff - yes, I write a lot of unused stuff
reportUnusedImport = "warning"
reportUnusedVariable = "none"
reportUnusedClass = "none"
reportUnusedFunction = "none"
# Unknown stuff - a lot of libs don't **properly** declare types
reportUnknownMemberType = "none"
reportUnknownVariableType = "none"
reportUnknownArgumentType = "none"
# there is a lot of **Incompatible** overriding in discord.py Bot development
# like `convert(ctx: AluContext, argument: str)` in converters.
reportIncompatibleVariableOverride = "none"
reportIncompatibleMethodOverride = "none"
[tool.ruff]
# https://docs.astral.sh/ruff/rules/
# Examples of good ruff configurations:
# * https://github.com/AbstractUmbra/Mipha/blob/main/pyproject.toml
# * https://github.com/mikeshardmind/async-utils/blob/main/pyproject.toml
line-length = 120
target-version = "py312"
# requires-python = ">= 3.10"
[tool.ruff.lint]
preview = true
select = [
"A", # shadowing
"ANN", # annotations
"ASYNC", # async
"B", # _bug-bear
"BLE", # blind except
"C4", # better list/set/dict comprehensions
"COM", # commas
"DTZ", # datetime timezone
"E", # pycodestyle against PEP-8
"EM", # exception messages
"ERA", # eradicate commented out code
"F", # pyflakes analyze for errors
"FA", # future annotations
"FBT", # boolean trap
"FURB", # refurbishing and modernizing Python codebases. # cSpell: ignore FURB
"G", # logging format
"I", # isort
"INP", # ban PEP-420 (implicit-namespace-package)
"ICN", # import conventions
"ISC", # encourage correct string literal concatenation.
"NPY", # NumPy specific rules
"PD", # Pandas specific rules
"PERF", # performance anti-patterns
"PGH", # py grep-hooks
"PIE", # miscellaneous lints
"PLC", # PyLint Conventions
"PLE", # PyLint Errors
"PLR", # PyLint Refactor
"PLW", # PyLint Warnings
"PTH", # Use PathLib
"PYI", # linting for stub files
"Q", # quotes
"Q003", # change outer quotes to avoid escaping inner quotes
"RET", # return
"RSE", # raise statements.
"RUF", # Ruff-specific rules
"S", # security testing
"SIM", # simplify
"SLOT", # require __slots__ to be defined for subclasses of immutable types
"T20", # print
"TC", # type checking
"TID", # tidy imports
"TRY", # clean try/except
"UP", # upgrade syntax for newer versions of the language.
"YTT", # misuse of sys.version or sys.version_info
# EXPERIMENTAL ADDITIONS
"W", # pycodestyle warnings
"N", # pep-8 namings
"D", # Doc-string madness, kinda annoying for a bot, to be honest
"DOC" # Doc strings, kinda annoying for a bot, to be honest
]
ignore = [
# 1. General "Somewhat Public" disagreement with Ruff
"ANN401", # `Any` is the correct type in some cases
"ASYNC109", # dpy and other libraries commonly use this parameter
"ASYNC116", # Long sleeps are fine
"C90", # mc cabe complexity memes
"COM812", # Ruff page recommends using formatter instead
"COM819", # Ruff page recommends using formatter instead
"F401", # unused imports
"F403", # wildcard imports: `from math import *` are used in __init__.py a lot
"F405", # wildcard imports are not that bad
"INP001", # due to how we load modules this results in annoyances
"PLC0414", # pyright ruling for `as` imports needed
"PLC0415", # ruff gets this wrong, import needs to be not at top of file in some cases
"RUF001", # ambiguous characters not something I want to enforce here.
"RUF029", # no, don't try and tell me I'm wrong for async def when something is for an interface.
"S101", # use of assert here is a known quantity, blame typing memes
"S311", # standard pseudo-random generators are not suitable for cryptographic purposes, so what;
"TRY003", # over-eager rule
"TRY301", # unrealistic rule
# 2. Personal disagreement
"PLR0904", # too many public methods
"PLR0912", # too many branches
"PLR0913", # number of function arguments
"PLR0914", # too many variables: come on
"PLR0915", # too many statements: come on, not everything is solvable in <50 lines.
"PLR0917", # too many positional arguments
"PLR2004", # Magic value comparison, may remove later
"PLR6301", # discord.py uses `self` even if I don't
"S608", # I use f-strings with SQL and I don't know better;
"TID252", # My relative imports are quite well structured
# MISHA
# "EM101", # in this case this is okay
# "F402",
# "PD011", # this is not a numpy codebase
# "PERF203",
# "Q000",
# "RUF009",
# "SIM105",
# "UP034",
# "UP038",
# SINBAD
# "ANN202", # implied return fine sometimes
# "B901", # I'm aware of how generators as coroutines work
# "E501", # ruff format suggested
# "FBT003", # Wrong end to enforce this on.
# "G002", # erroneous issue with %-logging when logging can be confiured for % logging
# "ISC001", # ruff format suggested
# "PLC0105", # no, I don't like co naming style for typevars
# "SIM105", # supressable exception, I'm not paying the overhead of contextlib.supress for stylistic choices.
# "TC001", # I prefer to avoid if TYPE_CHECKING
# "TC002", # I prefer to avoid if TYPE_CHECKING
# "TC003", # I prefer to avoid if TYPE_CHECKING
# "UP007", # "Use | For Union" doesn't account for typevar tuple unpacking.
# "UP031", # No, I like % formatting more for some things...
# 3. Doc String: general exceptions
"D100", # Missing docstring in module: no, module level docs aren't always needed
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method: documenting magic methods is often dumb.
"D107", # Missing docstring in `__init__`: __init__ is the wrong place to doc this.
"D401", # Doc should be starting with an imperative verb: dumb rule tbh.
# 4. Doc String: exceptions for this bot because and it's pointless to document *everything* in one-person project.
"DOC201", # `return` is not documented in docstring
"DOC501", # raised exception is missing from docstring
# "D417", # Missing argument description. Otherwise, it keeps asking to document interaction/context args.
# "D203", # one-blank-line-before-class
# "D213", # multi-line-summary-second-line
]
unfixable = [
"E501", # line length handled in other ways by ruff format
"ERA", # Don't delete commented out code
]
[tool.ruff.lint.per-file-ignores]
"ext/beta.py" = ["ANN201"]
"*.ipynb" = ["T20", "F404", "ANN204"]
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
[tool.ruff.lint.isort]
split-on-trailing-comma = true
combine-as-imports = true
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true
[tool.ruff.lint.flake8-quotes]
inline-quotes = "double"
[project]
name = "AlueBot"
version = "2024.0.0"
requires-python = ">=3.12"
authors = [{ name = "Aluerie" }]
maintainers = [{ name = "Aluerie" }]
description = "Personal Twitch.tv Bot"