Skip to content

Commit 0ccf6a0

Browse files
committed
Add pylint configuration (WIP)
1 parent 0c6995d commit 0ccf6a0

File tree

2 files changed

+89
-148
lines changed

2 files changed

+89
-148
lines changed

.pylintrc

Lines changed: 0 additions & 148 deletions
This file was deleted.

pyproject.toml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,92 @@ extend-exclude = [
9898

9999
[tool.pytest.ini_options]
100100
asyncio_mode = 'auto'
101+
102+
[tool.pylint.main]
103+
py-version = "3.8.1"
104+
# speed up the run on most computers by using 2 processes
105+
# while keeping it conservative for less beefy machines
106+
jobs = 2
107+
load-plugins = [
108+
"pylint.extensions.docparams",
109+
"pylint.extensions.overlapping_exceptions",
110+
]
111+
112+
[tool.pylint.variables]
113+
allowed-redefined-builtins = ["id"]
114+
115+
[tool.pylint.messages_control]
116+
enable = [
117+
# pylint internal errors
118+
"F",
119+
# code errors
120+
"E",
121+
# code warnings
122+
"W",
123+
# reported when pylint comment is unused
124+
"useless-option-value",
125+
# reported when invalid pylint error name is used
126+
"unknown-option-value",
127+
128+
# report invalid pylint comments
129+
"bad-inline-option",
130+
# report usage of deprecated pylint pragmas
131+
"deprecated-pragma",
132+
# report when a whole file is ignored with a pylint comment
133+
"file-ignored",
134+
# report usage of message IDs instead of message names
135+
"use-symbolic-message-instead",
136+
# report unnecessary suppression of pylint message
137+
"useless-suppression",
138+
]
139+
disable = [
140+
"C", # TODO
141+
"R", # TODO
142+
143+
# flake8/ruff's errors
144+
"bad-indentation", # E999
145+
"bare-except", # E722
146+
"f-string-without-interpolation", # F541
147+
"function-redefined", # F811
148+
"misplaced-future", # F404
149+
"reimported", # F811
150+
"return-outside-function", # F706
151+
"undefined-all-variable", # F822
152+
"undefined-variable", # F821
153+
"unused-import", # F401
154+
"unused-variable", # F841 (note: pylint can set a dummy variable regex)
155+
"unused-wildcard-import", # F403 (note: pylint can actually infer usage)
156+
"used-before-assignment", # F823
157+
"wildcard-import", # F403
158+
159+
# Black reformats these away.
160+
"inconsistent-quotes",
161+
"unnecessary-semicolon",
162+
163+
# Used a lot in our code base, perhaps we should try to minimize it in the future.
164+
"broad-except",
165+
# pylint doesn't lint C extension modules which triggers this
166+
"c-extension-no-member",
167+
# To preserve current TODOs, we can't use this.
168+
"fixme",
169+
# Global statements may be discouraged but they have valid use cases.
170+
"global-statement",
171+
# A lot of false positives on async generators and d.py's maybe-async methods.
172+
# ref: https://github.com/PyCQA/pylint/issues/5761
173+
"invalid-overridden-method",
174+
# Seems to be pointless: https://github.com/PyCQA/pylint/issues/7396
175+
"keyword-arg-before-vararg",
176+
# Causes too many false positives due to no support for decorators.
177+
# ref: https://github.com/PyCQA/pylint/issues/1694
178+
"no-member",
179+
# We have a lot of APIs that are private to cog creators but not to us.
180+
"protected-access",
181+
# A lot of "false positives" due to pytest usage.
182+
"redefined-outer-name",
183+
# This is fine when exit code is checked after.
184+
"subprocess-run-check",
185+
# __permissions_hook is considered a private member and is part of Red's cog interface.
186+
"unused-private-member",
187+
# `if True/False` can be useful to shut up linters.
188+
"using-constant-test",
189+
]

0 commit comments

Comments
 (0)