Skip to content

Commit 0a9f51e

Browse files
committed
Add pylint configuration (WIP)
1 parent 1d38466 commit 0a9f51e

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
@@ -51,3 +51,92 @@
5151
# Might fix at some point by importing fixtures in conftest.py.
5252
"tests/*",
5353
]
54+
55+
[tool.pylint.main]
56+
py-version = "3.8.1"
57+
# speed up the run on most computers by using 2 processes
58+
# while keeping it conservative for less beefy machines
59+
jobs = 2
60+
load-plugins = [
61+
"pylint.extensions.docparams",
62+
"pylint.extensions.overlapping_exceptions",
63+
]
64+
65+
[tool.pylint.variables]
66+
allowed-redefined-builtins = ["id"]
67+
68+
[tool.pylint.messages_control]
69+
enable = [
70+
# pylint internal errors
71+
"F",
72+
# code errors
73+
"E",
74+
# code warnings
75+
"W",
76+
# reported when pylint comment is unused
77+
"useless-option-value",
78+
# reported when invalid pylint error name is used
79+
"unknown-option-value",
80+
81+
# report invalid pylint comments
82+
"bad-inline-option",
83+
# report usage of deprecated pylint pragmas
84+
"deprecated-pragma",
85+
# report when a whole file is ignored with a pylint comment
86+
"file-ignored",
87+
# report usage of message IDs instead of message names
88+
"use-symbolic-message-instead",
89+
# report unnecessary suppression of pylint message
90+
"useless-suppression",
91+
]
92+
disable = [
93+
"C", # TODO
94+
"R", # TODO
95+
96+
# flake8/ruff's errors
97+
"bad-indentation", # E999
98+
"bare-except", # E722
99+
"f-string-without-interpolation", # F541
100+
"function-redefined", # F811
101+
"misplaced-future", # F404
102+
"reimported", # F811
103+
"return-outside-function", # F706
104+
"undefined-all-variable", # F822
105+
"undefined-variable", # F821
106+
"unused-import", # F401
107+
"unused-variable", # F841 (note: pylint can set a dummy variable regex)
108+
"unused-wildcard-import", # F403 (note: pylint can actually infer usage)
109+
"used-before-assignment", # F823
110+
"wildcard-import", # F403
111+
112+
# Black reformats these away.
113+
"inconsistent-quotes",
114+
"unnecessary-semicolon",
115+
116+
# Used a lot in our code base, perhaps we should try to minimize it in the future.
117+
"broad-except",
118+
# pylint doesn't lint C extension modules which triggers this
119+
"c-extension-no-member",
120+
# To preserve current TODOs, we can't use this.
121+
"fixme",
122+
# Global statements may be discouraged but they have valid use cases.
123+
"global-statement",
124+
# A lot of false positives on async generators and d.py's maybe-async methods.
125+
# ref: https://github.com/PyCQA/pylint/issues/5761
126+
"invalid-overridden-method",
127+
# Seems to be pointless: https://github.com/PyCQA/pylint/issues/7396
128+
"keyword-arg-before-vararg",
129+
# Causes too many false positives due to no support for decorators.
130+
# ref: https://github.com/PyCQA/pylint/issues/1694
131+
"no-member",
132+
# We have a lot of APIs that are private to cog creators but not to us.
133+
"protected-access",
134+
# A lot of "false positives" due to pytest usage.
135+
"redefined-outer-name",
136+
# This is fine when exit code is checked after.
137+
"subprocess-run-check",
138+
# __permissions_hook is considered a private member and is part of Red's cog interface.
139+
"unused-private-member",
140+
# `if True/False` can be useful to shut up linters.
141+
"using-constant-test",
142+
]

0 commit comments

Comments
 (0)