-
Notifications
You must be signed in to change notification settings - Fork 9
/
.pylintrc
338 lines (287 loc) · 10.7 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
#
# This pylintrc targets pylint_version 1.9.5 for python2 to python3 --py3k linting:
# pylint version 1.9.5 is the last version which supports python2 code.
# Note: pylint version 1.9.5 needs to installed on python 2.7 for this to work.
# It is used by the github actionm for python2 linting in .github/workflows/main.yml
#
# After conversion to python3 is complete and python2-compat is no longer relevant,
# the latest pylint versions can be targeted instead.
#
# This pylintrc omits default values for the sake of brevity
# and is aimed ad python2 to python3 coversion.
# A complete .pylintrc (without manually added comments!) # can be generated using:
# pylint --generate-rcfile >.pylintrc.full
#
[MAIN]
# 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.
# defaults to: analyse-fallback-blocks=no
analyse-fallback-blocks=yes
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-allow-list=xen.lowlevel
extension-pkg-whitelist=lxml.etree
# Return non-zero exit code if any of these messages/categories are detected,
# even if score is above --fail-under value. Syntax same as enable. Messages
# specified are enabled, while categories only check already-enabled messages.
fail-on=redefined-variable-type
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use, and will cap the count on Windows to
# avoid hangs.
# defaults to: jobs=1
jobs=4
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
# defaults to: load-plugins=
load-plugins=
pylint.extensions.check_elif,
pylint.extensions.bad_builtin,
pylint.extensions.docparams,
pylint.extensions.for_any_all,
pylint.extensions.set_membership,
pylint.extensions.code_style,
pylint.extensions.overlapping_exceptions,
pylint.extensions.typing,
pylint.extensions.redefined_variable_type,
pylint.extensions.comparison_placement,
pylint.extensions.broad_try_clause,
pylint.extensions.dict_init_mutate,
pylint.extensions.consider_refactoring_into_while_condition,
# Minimum Python version to use for version dependent checks. Will default to
# the version used to run pylint.
py-version=2.7
[BASIC]
# Good variable names which should always be accepted, separated by a comma.
good-names=b,
i,
fd,
j,
k,
s,
ex,
Run,
_
# xen-bugtool unfortunately exceeds nearly all good design recommendations:
[BROAD_TRY_CLAUSE]
# Maximum number of statements allowed in a try clause
max-try-statements=11
[DESIGN]
# Maximum number of arguments for function / method.
# defaults to: max-args=5
max-args=10
# Maximum number of attributes for a class (see R0902).
# defaults to: max-attributes=7
max-attributes=11
# Maximum number of branch for function / method body.
# defaults to: max-branches=12
max-branches=18
# Maximum number of locals for function / method body.
# defaults to: max-locals=15
max-locals=30
# Maximum number of return / yield for function / method body.
# defaults to: max-returns=6
max-returns=11
# Maximum number of statements in function / method body.
# defaults to: max-statements=50
# For the Python3 fix for bugtool.load_plugins():
max-statements=52
[FORMAT]
# Maximum number of characters on a single line.
# defaults to: max-line-length=100
max-line-length=120
# Maximum number of lines in a module.
# defaults to: max-module-lines=1000
max-module-lines=2000
[IMPORTS]
# List of modules that can be imported at any level, not just the top level
# one.
allow-any-import-level=XenAPI,xen.lowlevel.xc
[MESSAGES CONTROL]
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then re-enable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
# Common checks which need to be disabled for now and shall be fixed one by one:
disable=anomalous-backslash-in-string,
attribute-defined-outside-init,
bad-builtin,
bad-continuation,
bad-whitespace,
bare-except,
broad-except,
consider-iterating-dictionary,
consider-using-dict-items,
consider-using-f-string,
consider-using-generator,
consider-using-in,
consider-using-ternary,
consider-using-tuple,
consider-using-with,
deprecated-lambda,
else-if-used,
fixme,
global-statement,
import-error,
import-outside-toplevel,
invalid-name,
invalid-name,
len-as-condition,
missing-type-doc, # better do typing than type in the param docstring
no-else-break,
no-else-return,
no-name-in-module,
no-self-use,
old-style-class,
protected-access,
redefined-builtin,
redefined-outer-name,
simplify-boolean-expression,
singleton-comparison,
superfluous-parens,
too-few-public-methods,
too-many-lines,
too-many-locals,
# Skip complaining about checkers only present in newer pylint for Python3
unknown-option-value,
unspecified-encoding,
unused-argument,
use-set-for-membership,
# Skip complaining about checkers only present in older pylint for Python2
useless-option-value,
# Skip complaining about checkers only present in newest pylint for Python3
bad-option-value,
wrong-import-order,
# Py2 compat: Python2 requires calls to super() to have it's arguments:
super-with-arguments,
# Py2 compat: As long as we try to use conditional imports for Py2+Py3:
ungrouped-imports,
use-maxsplit-arg
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
# Python3 conversion (--py3k) checks.
# The checks which are not enabled yet need to be fixed before they can be enabled.
enable=c-extension-no-member,
# print-statement,
# parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
bad-inline-option,
locally-enabled,
file-ignored,
useless-suppression,
deprecated-pragma,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
# file-builtin,
# long-builtin,
# raw_input-builtin,
reduce-builtin,
standarderror-builtin,
# unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
# no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
round-builtin,
intern-builtin,
unichr-builtin,
# dict-items-not-iterating,
# dict-keys-not-iterating,
# dict-values-not-iterating
# map-builtin-not-iterating,
zip-builtin-not-iterating,
# range-builtin-not-iterating,
# filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
# bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
# Not related to pyling --py3k, but catched a bug which no other checker found:
redefined-variable-type
[PARAMETER_DOCUMENTATION]
# xen-bugtool does not contain any docstrings yet:
# Whether to accept totally missing parameter documentation in the docstring of
# a function that has parameters.
accept-no-param-doc=yes
# Whether to accept totally missing raises documentation in the docstring of a
# function that raises an exception.
accept-no-raise-doc=yes
# Whether to accept totally missing return documentation in the docstring of a
# function that returns a statement.
accept-no-return-doc=yes
# Whether to accept totally missing yields documentation in the docstring of a
# generator.
accept-no-yields-doc=yes
# If the docstring type cannot be guessed the specified docstring type will be
# used.
default-docstring-type=default
[SIMILARITIES]
# Minimum lines number of a similarity.
# defaults to: min-similarity-lines=4
min-similarity-lines=6
[SPELLING]
# Limits count of emitted suggestions for spelling mistakes.
max-spelling-suggestions=1
# Spelling dictionary name. Available dictionaries: en (aspell), en_AU
# (aspell), en_CA (aspell), en_GB (aspell), en_US (aspell).
# To support spelling checks for older python2 pylint versions,
# `sudo apt-get install -y libenchant-2-2` would be needed,
# so we enable it for newer Python3 pylint in .pre-commit-config.yaml:
#spelling-dict=en_US
# A path to a file that contains the private dictionary; one word per line.
spelling-private-dict-file=.vscode/ltex.dictionary.en-US.txt
# Tells whether to store unknown words to the private dictionary (see the
# --spelling-private-dict-file option) instead of raising a message.
spelling-store-unknown-words=no
[TYPING]
# Applications do not need runtime typing introspection:
# Set to ``no`` if the app / library does **NOT** need to support runtime
# introspection of type annotations. If you use type annotations
# **exclusively** for type checking of an application, you're probably fine.
# For libraries, evaluate if some users want to access the type hints at
# runtime first, e.g., through ``typing.get_type_hints``. Applies to Python
# versions 3.7 - 3.9
runtime-typing=no