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