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    superfluous-parens,
78    mixed-line-endings,
79    unexpected-line-ending-format,
80    invalid-characters-in-docstring,
81    useless-import-alias,
82    len-as-condition,
83    syntax-error,
84    init-is-generator,
85    return-in-init,
86    function-redefined,
87    not-in-loop,
88    return-outside-function,
89    yield-outside-function,
90    nonexistent-operator,
91    duplicate-argument-name,
92    abstract-class-instantiated,
93    bad-reversed-sequence,
94    too-many-star-expressions,
95    invalid-star-assignment-target,
96    star-needs-assignment-target,
97    nonlocal-and-global,
98    continue-in-finally,
99    nonlocal-without-binding,
100    misplaced-format-function,
101    method-hidden,
102    access-member-before-definition,
103    no-method-argument,
104    no-self-argument,
105    invalid-slots-object,
106    assigning-non-slot,
107    invalid-slots,
108    inherit-non-class,
109    inconsistent-mro,
110    duplicate-bases,
111    non-iterator-returned,
112    unexpected-special-method-signature,
113    invalid-length-returned,
114    relative-beyond-top-level,
115    used-before-assignment,
116    undefined-variable,
117    undefined-all-variable,
118    invalid-all-object,
119    no-name-in-module,
120    unpacking-non-sequence,
121    bad-except-order,
122    raising-bad-type,
123    bad-exception-context,
124    misplaced-bare-raise,
125    raising-non-exception,
126    notimplemented-raised,
127    catching-non-exception,
128    bad-super-call,
129    not-callable,
130    assignment-from-no-return,
131    no-value-for-parameter,
132    too-many-function-args,
133    unexpected-keyword-arg,
134    redundant-keyword-arg,
135    missing-kwoa,
136    invalid-sequence-index,
137    invalid-slice-index,
138    assignment-from-none,
139    not-context-manager,
140    invalid-unary-operand-type,
141    unsupported-binary-operation,
142    repeated-keyword,
143    not-an-iterable,
144    not-a-mapping,
145    unsupported-membership-test,
146    unsubscriptable-object,
147    unsupported-assignment-operation,
148    unsupported-delete-operation,
149    invalid-metaclass,
150    unhashable-dict-key,
151    logging-unsupported-format,
152    logging-format-truncated,
153    logging-too-many-args,
154    logging-too-few-args,
155    bad-format-character,
156    truncated-format-string,
157    mixed-format-string,
158    format-needs-mapping,
159    missing-format-string-key,
160    too-many-format-args,
161    too-few-format-args,
162    bad-string-format-type,
163    bad-str-strip-call,
164    invalid-envvar-value,
165    yield-inside-async-function,
166    not-async-context-manager,
167    useless-suppression,
168    deprecated-pragma,
169    use-symbolic-message-instead,
170    literal-comparison,
171    comparison-with-itself,
172    no-classmethod-decorator,
173    no-staticmethod-decorator,
174    cyclic-import,
175    duplicate-code,
176    consider-merging-isinstance,
177    simplifiable-if-statement,
178    redefined-argument-from-local,
179    trailing-comma-tuple,
180    stop-iteration-return,
181    useless-return,
182    consider-swap-variables,
183    consider-using-join,
184    consider-using-in,
185    chained-comparison,
186    consider-using-dict-comprehension,
187    consider-using-set-comprehension,
188    simplifiable-if-expression,
189    unreachable,
190    pointless-statement,
191    pointless-string-statement,
192    expression-not-assigned,
193    unnecessary-pass,
194    unnecessary-lambda,
195    duplicate-key,
196    useless-else-on-loop,
197    confusing-with-statement,
198    using-constant-test,
199    comparison-with-callable,
200    lost-exception,
201    assert-on-tuple,
202    bad-staticmethod-argument,
203    super-init-not-called,
204    non-parent-init-called,
205    useless-super-delegation,
206    unnecessary-semicolon,
207    bad-indentation,
208    deprecated-module,
209    reimported,
210    import-self,
211    misplaced-future,
212    global-variable-not-assigned,
213    unused-variable,
214    undefined-loop-variable,
215    unbalanced-tuple-unpacking,
216    possibly-unused-variable,
217    self-cls-assignment,
218    bare-except,
219    duplicate-except,
220    try-except-raise,
221    binary-op-exception,
222    raising-format-tuple,
223    wrong-exception-operation,
224    keyword-arg-before-vararg,
225    bad-format-string-key,
226    unused-format-string-key,
227    bad-format-string,
228    unused-format-string-argument,
229    format-combined-specification,
230    missing-format-attribute,
231    invalid-format-index,
232    anomalous-backslash-in-string,
233    anomalous-unicode-escape-in-string,
234    bad-open-mode,
235    redundant-unittest-assert,
236    deprecated-method,
237    bad-thread-instantiation,
238    shallow-copy-environ,
239    invalid-envvar-default,
240    # Custom Zephyr check scripts
241    zephyr-arg-parse,
242
243[SIMILARITIES]
244
245# Minimum lines number of a similarity.
246min-similarity-lines=20
247
248# Ignore comments when computing similarities.
249ignore-comments=yes
250
251# Ignore docstrings when computing similarities.
252ignore-docstrings=yes
253
254# Ignore imports when computing similarities.
255ignore-imports=yes
256