1# Copyright (c) 2019, Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4# pylint configuration for the PyLint check in check_compliance.py.
5#
6# To run pylint manually with this configuration from the Zephyr repo, do
7#
8#     pylint3 --rcfile=ci-tools/scripts/pylintrc <Python file>
9#
10# This command will check all scripts:
11#
12#     pylint3 --rcfile=ci-tools/scripts/pylintrc $(git ls-files '*.py')
13
14[MASTER]
15
16# Use multiple processes
17jobs=0
18
19# Do not pickle collected data for comparisons
20persistent=no
21
22
23[REPORTS]
24
25# Only show messages, not full report
26reports=no
27
28# Disable score
29score=no
30
31
32[MESSAGES CONTROL]
33
34# Only enable specific (hopefully) uncontroversial warnings. Use
35# 'pylint3 --list-msgs' to list messages and their IDs.
36#
37# These might be nice to check too, but currently trigger false positives:
38#
39#   no-member
40#   arguments-differ
41#   redefine-in-handler
42#   abstract-method
43#
44# These might be too controversial:
45#
46#   no-else-return
47#   consider-using-get
48#   redefined-builtin
49#
50# These tell you to use logger.warning("foo %d bar", 3) instead of e.g.
51# logger.warning("foo {} bar".format(3)), but it's not a clear win in all
52# cases. f-strings would be nicer too, and it's easier to convert from format()
53# to those.
54#
55#   logging-not-lazy
56#   logging-format-interpolation
57#   logging-fstring-interpolation
58
59disable=all
60# Identifiers are in the same order as in 'pylint3 --list-msgs'. Entire
61# message "types" (~= severities) like F(atal), E(error),... are listed
62# first.
63enable=
64    F, # atal
65    empty-docstring,
66    unneeded-not,
67    singleton-comparison,
68    unidiomatic-typecheck,
69    consider-using-enumerate,
70    consider-iterating-dictionary,
71    bad-classmethod-argument,
72    bad-mcs-method-argument,
73    bad-mcs-classmethod-argument,
74    single-string-used-for-slots,
75    trailing-newlines,
76    trailing-whitespace,
77    missing-final-newline,
78    superfluous-parens,
79    mixed-line-endings,
80    unexpected-line-ending-format,
81    invalid-characters-in-docstring,
82    useless-import-alias,
83    len-as-condition,
84    syntax-error,
85    init-is-generator,
86    return-in-init,
87    function-redefined,
88    not-in-loop,
89    return-outside-function,
90    yield-outside-function,
91    nonexistent-operator,
92    duplicate-argument-name,
93    abstract-class-instantiated,
94    bad-reversed-sequence,
95    too-many-star-expressions,
96    invalid-star-assignment-target,
97    star-needs-assignment-target,
98    nonlocal-and-global,
99    continue-in-finally,
100    nonlocal-without-binding,
101    misplaced-format-function,
102    method-hidden,
103    access-member-before-definition,
104    no-method-argument,
105    no-self-argument,
106    invalid-slots-object,
107    assigning-non-slot,
108    invalid-slots,
109    inherit-non-class,
110    inconsistent-mro,
111    duplicate-bases,
112    non-iterator-returned,
113    unexpected-special-method-signature,
114    invalid-length-returned,
115    relative-beyond-top-level,
116    used-before-assignment,
117    undefined-variable,
118    undefined-all-variable,
119    invalid-all-object,
120    no-name-in-module,
121    unpacking-non-sequence,
122    bad-except-order,
123    raising-bad-type,
124    bad-exception-context,
125    misplaced-bare-raise,
126    raising-non-exception,
127    notimplemented-raised,
128    catching-non-exception,
129    bad-super-call,
130    not-callable,
131    assignment-from-no-return,
132    no-value-for-parameter,
133    too-many-function-args,
134    unexpected-keyword-arg,
135    redundant-keyword-arg,
136    missing-kwoa,
137    invalid-sequence-index,
138    invalid-slice-index,
139    assignment-from-none,
140    not-context-manager,
141    invalid-unary-operand-type,
142    unsupported-binary-operation,
143    repeated-keyword,
144    not-an-iterable,
145    not-a-mapping,
146    unsupported-membership-test,
147    unsubscriptable-object,
148    unsupported-assignment-operation,
149    unsupported-delete-operation,
150    invalid-metaclass,
151    unhashable-dict-key,
152    logging-unsupported-format,
153    logging-format-truncated,
154    logging-too-many-args,
155    logging-too-few-args,
156    bad-format-character,
157    truncated-format-string,
158    mixed-format-string,
159    format-needs-mapping,
160    missing-format-string-key,
161    too-many-format-args,
162    too-few-format-args,
163    bad-string-format-type,
164    bad-str-strip-call,
165    invalid-envvar-value,
166    yield-inside-async-function,
167    not-async-context-manager,
168    useless-suppression,
169    deprecated-pragma,
170    use-symbolic-message-instead,
171    literal-comparison,
172    comparison-with-itself,
173    no-classmethod-decorator,
174    no-staticmethod-decorator,
175    cyclic-import,
176    duplicate-code,
177    consider-merging-isinstance,
178    simplifiable-if-statement,
179    redefined-argument-from-local,
180    trailing-comma-tuple,
181    stop-iteration-return,
182    useless-return,
183    consider-swap-variables,
184    consider-using-join,
185    consider-using-in,
186    chained-comparison,
187    consider-using-dict-comprehension,
188    consider-using-set-comprehension,
189    simplifiable-if-expression,
190    unreachable,
191    pointless-statement,
192    pointless-string-statement,
193    expression-not-assigned,
194    unnecessary-pass,
195    unnecessary-lambda,
196    duplicate-key,
197    useless-else-on-loop,
198    confusing-with-statement,
199    using-constant-test,
200    comparison-with-callable,
201    lost-exception,
202    assert-on-tuple,
203    bad-staticmethod-argument,
204    super-init-not-called,
205    non-parent-init-called,
206    useless-super-delegation,
207    unnecessary-semicolon,
208    bad-indentation,
209    deprecated-module,
210    reimported,
211    import-self,
212    misplaced-future,
213    global-variable-not-assigned,
214    unused-import,
215    unused-variable,
216    undefined-loop-variable,
217    unbalanced-tuple-unpacking,
218    possibly-unused-variable,
219    self-cls-assignment,
220    bare-except,
221    duplicate-except,
222    try-except-raise,
223    binary-op-exception,
224    raising-format-tuple,
225    wrong-exception-operation,
226    keyword-arg-before-vararg,
227    bad-format-string-key,
228    unused-format-string-key,
229    bad-format-string,
230    unused-format-string-argument,
231    format-combined-specification,
232    missing-format-attribute,
233    invalid-format-index,
234    anomalous-backslash-in-string,
235    anomalous-unicode-escape-in-string,
236    bad-open-mode,
237    redundant-unittest-assert,
238    deprecated-method,
239    bad-thread-instantiation,
240    shallow-copy-environ,
241    invalid-envvar-default,
242    # Custom Zephyr check scripts
243    zephyr-arg-parse,
244
245[SIMILARITIES]
246
247# Minimum lines number of a similarity.
248min-similarity-lines=20
249
250# Ignore comments when computing similarities.
251ignore-comments=yes
252
253# Ignore docstrings when computing similarities.
254ignore-docstrings=yes
255
256# Ignore imports when computing similarities.
257ignore-imports=yes
258