-
Notifications
You must be signed in to change notification settings - Fork 17
/
.pylintrc
456 lines (382 loc) · 13.9 KB
/
.pylintrc
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
#
# Since this is used by CI, this should enable only errors, which can gate
# commit. That means anything that may have false positives should be omitted,
# unless the false positives are rare and the lint is valuable, in which case
# people have to disable with a pragma in the source (see
# http://pylint.pycqa.org/en/latest/user_guide/message-control.html).
#
# This is intended to be PEP 8: https://www.python.org/dev/peps/pep-0008/
[MASTER]
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use.
jobs = 0
# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
# complex, nested conditions.
limit-inference-results = 100
# Pickle collected data for later comparisons.
persistent = no
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode = yes
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension = yes
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
confidence =
disable = all
# These categories are documented at:
# https://pylint.readthedocs.io/en/latest/technical_reference/features.html
#
# Pylint doesn't let us subtract from 'enable', so if we don't want something
# in a category, we have to first expand it. I put them in the same order as
# the documentation page, for easier reference. The documentation order is
# by priority: Error, Warning, Refactor, Convention.
enable =
### basic: naming, errors, etc:
not-in-loop,
function-redefined,
continue-in-finally,
abstract-class-instantiated,
star-needs-assignment-target,
duplicate-argument-name,
return-in-init,
too-many-star-expressions,
nonlocal-and-global,
used-prior-global-declaration,
return-outside-function,
return-arg-in-generator,
invalid-star-assignment-target,
bad-reversed-sequence,
nonexistent-operator,
yield-outside-function,
init-is-generator,
misplaced-format-function,
nonlocal-without-binding,
lost-exception,
assert-on-tuple,
assert-on-string-literal,
self-assigning-variable,
comparison-with-callable,
dangerous-default-value,
duplicate-key,
useless-else-on-loop,
expression-not-assigned,
confusing-with-statement,
unnecessary-lambda,
assign-to-new-keyword,
redeclared-assigned-name,
pointless-statement,
pointless-string-statement,
unnecessary-pass,
unreachable,
eval-used,
exec-used,
# using-constant-test, # e.g. if True, but it's useful to comment out
missing-parentheses-for-call-in-test,
literal-comparison,
comparison-with-itself,
non-ascii-name,
invalid-name,
# blacklisted-name, # nothing to blacklist
# misplaced-comparison-constant, # doesn't like '1 < var', but that's fine
singleton-comparison,
empty-docstring,
missing-class-docstring,
missing-function-docstring,
# missing-module-docstring, # leads to silly dummy module docstrings
unidiomatic-typecheck,
### classes
# Random class-oriented checks:
# Some of them are advice, e.g. no-self-use, and should probably be omitted.
access-member-before-definition,
method-hidden,
assigning-non-slot,
duplicate-bases,
inconsistent-mro,
inherit-non-class,
invalid-slots,
invalid-slots-object,
no-method-argument,
no-self-argument,
unexpected-special-method-signature,
class-variable-slots-conflict,
non-iterator-returned,
invalid-length-returned,
protected-access,
attribute-defined-outside-init,
no-init,
abstract-method,
invalid-overridden-method,
arguments-differ,
signature-differs,
bad-staticmethod-argument,
useless-super-delegation,
non-parent-init-called,
super-init-not-called,
property-with-parameters,
useless-object-inheritance,
no-classmethod-decorator,
no-staticmethod-decorator,
# no-self-use, # this is design advice
single-string-used-for-slots,
bad-classmethod-argument,
bad-mcs-classmethod-argument,
bad-mcs-method-argument,
method-check-failed,
### design
# omitted, it's just arbitrary limits
### exceptions
bad-except-order,
catching-non-exception,
bad-exception-context,
notimplemented-raised,
raising-bad-type,
raising-non-exception,
misplaced-bare-raise,
duplicate-except,
broad-except,
raising-format-tuple,
binary-op-exception,
wrong-exception-operation,
bare-except,
try-except-raise,
### format
# Line length, indentation, whitespace:
bad-indentation,
mixed-indentation,
unnecessary-semicolon,
bad-whitespace,
missing-final-newline,
line-too-long,
mixed-line-endings,
multiple-statements,
# too-many-lines, # limit on total module size, not pep8
trailing-newlines,
trailing-whitespace,
unexpected-line-ending-format,
superfluous-parens,
# bad-continuation, # pylint wants vertical line-up, but that's not pep8
### imports
# import *, relative imports, etc. The stuff with import order is probably
# sketchy and will have to be removed.
import-error,
# relative-beyond-top-level, # pylint doesn't recognize our packages
import-self,
preferred-module,
reimported,
relative-import,
deprecated-module,
wildcard-import,
misplaced-future,
cyclic-import,
wrong-import-order,
wrong-import-position,
useless-import-alias,
ungrouped-imports,
multiple-imports,
# omit 'logging', it's advice for the standard logging module
# omit 'python3', we already use python3
# omit 'refactoring', it's arbitrary limits and optional advice
# omit 'similarities', it's also advice
# omit 'spelling', it's advice
# Random stuff which is probably irrelevant but shouldn't hurt:
stdlib,
# Format strings.
string,
### typecheck
# No such variable etc. These seem useful but might have false positives,
# disable if it turns out they do.
unsupported-delete-operation,
invalid-unary-operand-type,
unsupported-binary-operation,
no-member,
not-callable,
redundant-keyword-arg,
assignment-from-no-return,
assignment-from-none,
# not-context-manager, # false positives
unhashable-dict-key,
repeated-keyword,
invalid-metaclass,
missing-kwoa,
no-value-for-parameter,
not-an-iterable,
not-a-mapping,
invalid-sequence-index,
invalid-slice-index,
too-many-function-args,
unexpected-keyword-arg,
dict-iter-missing-items,
unsupported-membership-test,
unsubscriptable-object,
keyword-arg-before-vararg,
non-str-assignment-to-dunder-name,
arguments-out-of-order,
isinstance-second-argument-not-valid-type,
c-extension-no-member,
### variables
# Unused imports, unused variables.
unpacking-non-sequence,
invalid-all-object,
no-name-in-module,
undefined-variable,
undefined-all-variable,
used-before-assignment,
cell-var-from-loop,
global-variable-undefined,
self-cls-assignment,
unbalanced-tuple-unpacking,
possibly-unused-variable, # unless locals(), but don't use locals()
unused-import,
unused-argument,
unused-wildcard-import,
unused-variable,
global-variable-not-assigned,
undefined-loop-variable,
global-at-module-level,
[REPORTS]
# We want binary yes or no, not a score.
score = no
reports = no
[FORMAT]
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines = ^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren = 4
# String used as indentation unit.
indent-string = ' '
# Maximum number of characters on a single line. pylint has to be looser since
# black doesn't always obey its own limit. See pyproject.toml.
max-line-length = 100
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check =
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt = no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt = no
[TYPECHECK]
# These checks seem sketchy, disable them if they give false positives.
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators = contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
# https://github.com/pytorch/pytorch/issues/701#issuecomment-378048755
generated-members = numpy\..*, torch\..*, transformers.*
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members = yes
# Tells whether to warn about missing members when the owner of the attribute
# is inferred to be None. But the inference is buggy, so disable it.
ignore-none = yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference = yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes = optparse.Values, thread._local, _thread._local
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules =
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint = yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance = 1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices = 1
[VARIABLES]
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables = yes
# A regular expression matching the name of dummy variables (i.e. expected to
# not be used).
dummy-variables-rgx = _+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)
# Argument names that match this expression will be ignored. Default to name
# with leading underscore.
ignored-argument-names = _.*
# Tells whether we should check for unused import in __init__ files.
init-import = no
[BASIC]
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
#
# This doesn't actually work like the documentation implies, so I still have to
# individually write regexes for each one, but I'll leave it here for
# documentation.
name-group = variable:inlinevar:argument:attr:function:method
# snake_case insists on >2 chars, which is not PEP8, so I write my own regex:
argument-rgx = [a-z0-9_]+
attr-rgx = [a-z0-9_]+
class-attribute-rgx = ([a-z0-9_]+|[A-Z0-9_]+)
function-rgx = [a-z0-9_]+
inlinevar-rgx = [a-z0-9_]+
method-rgx = [a-z0-9_]+
variable-rgx = [a-z0-9_]+
# module-naming-style = snake_case
module-rgx = [a-z0-9_]+
class-rgx = [A-Z_][a-zA-Z0-9]*$
# To pylint, "const" doesn't mean constant, it means "defined at module level
# and not a function or class." PEP8 says UPPER_CASE for constants, but pylint
# can't tell which is which, so allow both.
const-rgx = ([a-z0-9_]+|[A-Z0-9_]+)
include-naming-hint = yes
# Docstrings not required anywhere.
no-docstring-rgx = .
# Omit private functions.
# no-docstring-rgx = ^_
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods = __init__, __new__, setUp
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected = _asdict, _fields, _replace, _source, _make
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg = cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg = cls
[IMPORTS]
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all = no
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks = no
# Deprecated modules which should not be used, separated by a comma.
deprecated-modules = optparse,tkinter.tix
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled).
ext-import-graph =
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled).
import-graph =
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled).
int-import-graph =
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library =
# Force import order to recognize a module as part of a third party library.
known-third-party =
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception".
overgeneral-exceptions = builtins.Exception