• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15[MASTER]  # inclusive-language: ignore
16
17# Add files or directories to the blocklist. They should be base names, not
18# paths.
19ignore=CVS
20
21# Add files or directories matching the regex patterns to the blocklist. The
22# regex matches against base names, not paths.
23ignore-patterns=
24
25# Python code to execute, usually for sys.path manipulation such as
26# pygtk.require().
27#init-hook=
28
29# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
30# number of processors available to use.
31jobs=0
32
33# Control the amount of potential inferred values when inferring a single
34# object. This can help the performance when dealing with large functions or
35# complex, nested conditions.
36limit-inference-results=100
37
38# List of plugins (as comma separated values of python module names) to load,
39# usually to register additional checkers.
40load-plugins=pylint.extensions.no_self_use
41
42# Pickle collected data for later comparisons.
43persistent=yes
44
45# Specify a configuration file.
46#rcfile=
47
48# When enabled, pylint would attempt to guess common misconfiguration and emit
49# user-friendly hints instead of false-positive error messages.
50suggestion-mode=yes
51
52# Allow loading of arbitrary C extensions. Extensions are imported into the
53# active Python interpreter and may run arbitrary code.
54unsafe-load-any-extension=no
55
56
57[MESSAGES CONTROL]
58
59# Only show warnings with the listed confidence levels. Leave empty to show
60# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
61confidence=
62
63# Disable the message, report, category or checker with the given id(s). You
64# can either give multiple identifiers separated by comma (,) or put this
65# option multiple times (only on the command line, not in the configuration
66# file where it should appear only once). You can also use "--disable=all" to
67# disable everything first and then reenable specific checks. For example, if
68# you want to run only the similarities checker, you can use "--disable=all
69# --enable=similarities". If you want to run only the classes checker, but have
70# no Warning level messages displayed, use "--disable=all --enable=classes
71# --disable=W".
72disable=broad-exception-raised,
73        consider-iterating-dictionary,
74        consider-using-f-string,
75        consider-using-generator,
76        consider-using-in,
77        consider-using-with,
78        fixme,
79        implicit-str-concat,
80        raise-missing-from,
81        redundant-u-string-prefix,
82        subprocess-run-check,
83        superfluous-parens,
84        unnecessary-lambda-assignment,
85        unspecified-encoding,
86        use-dict-literal,
87        use-list-literal,
88
89
90# Enable the message, report, category or checker with the given id(s). You can
91# either give multiple identifier separated by comma (,) or put this option
92# multiple time (only on the command line, not in the configuration file where
93# it should appear only once). See also the "--disable" option for examples.
94enable=c-extension-no-member,
95
96
97[REPORTS]
98
99# Python expression which should return a score less than or equal to 10. You
100# have access to the variables 'error', 'warning', 'refactor', and 'convention'
101# which contain the number of messages in each category, as well as 'statement'
102# which is the total number of statements analyzed. This score is used by the
103# global evaluation report (RP0004).
104evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
105
106# Template used to display messages. This is a python new-style format string
107# used to format the message information. See doc for all details.
108#msg-template=
109
110# Set the output format. Available formats are text, parseable, colorized, json
111# and msvs (visual studio). You can also give a reporter class, e.g.
112# mypackage.mymodule.MyReporterClass.
113output-format=colorized
114
115# Tells whether to display a full report or only the messages.
116reports=no
117
118# Activate the evaluation score.
119score=no
120
121
122[REFACTORING]
123
124# Maximum number of nested blocks for function / method body
125max-nested-blocks=5
126
127# Complete name of functions that never returns. When checking for
128# inconsistent-return-statements if a never returning function is called then
129# it will be considered as an explicit return statement and no message will be
130# printed.
131never-returning-functions=sys.exit
132
133
134[FORMAT]
135
136# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
137expected-line-ending-format=LF
138
139# Regexp for a line that is allowed to be longer than the limit.
140ignore-long-lines=^\s*(# )?<?https?://\S+>?$
141
142# Number of spaces of indent required inside a hanging or continued line.
143indent-after-paren=4
144
145# String used as indentation unit. This is usually "    " (4 spaces) or "\t" (1
146# tab).
147indent-string='    '
148
149# Maximum number of characters on a single line.
150max-line-length=80
151
152# Maximum number of lines in a module.
153max-module-lines=9999
154
155# Allow the body of a class to be on the same line as the declaration if body
156# contains single statement.
157single-line-class-stmt=no
158
159# Allow the body of an if to be on the same line as the test if there is no
160# else.
161single-line-if-stmt=no
162
163
164[VARIABLES]
165
166# List of additional names supposed to be defined in builtins. Remember that
167# you should avoid defining new builtins when possible.
168additional-builtins=
169
170# Tells whether unused global variables should be treated as a violation.
171allow-global-unused-variables=yes
172
173# List of strings which can identify a callback function by name. A callback
174# name must start or end with one of those strings.
175callbacks=cb_,
176          _cb
177
178# A regular expression matching the name of placeholder variables (i.e.
179# expected to not be used). # inclusive-language: ignore
180dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
181
182# Argument names that match this expression will be ignored. Default to name
183# with leading underscore.
184ignored-argument-names=_.*|^ignored_|^unused_
185
186# Tells whether we should check for unused import in __init__ files.
187init-import=no
188
189# List of qualified module names which can have objects that can redefine
190# builtins.
191redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
192
193
194[SPELLING]
195
196# Limits count of emitted suggestions for spelling mistakes.
197max-spelling-suggestions=4
198
199# Spelling dictionary name. Available dictionaries: none. To make it work,
200# install the python-enchant package.
201spelling-dict=
202
203# List of comma separated words that should not be checked.
204spelling-ignore-words=
205
206# A path to a file that contains the private dictionary; one word per line.
207spelling-private-dict-file=
208
209# Tells whether to store unknown words to the private dictionary (see the
210# --spelling-private-dict-file option) instead of raising a message.
211spelling-store-unknown-words=no
212
213
214[LOGGING]
215
216# Format style used to check logging format string. `old` means using %
217# formatting, `new` is for `{}` formatting,and `fstr` is for f-strings.
218logging-format-style=old
219
220# Logging modules to check that the string format arguments are in logging
221# function parameter format.
222logging-modules=logging
223
224
225[SIMILARITIES]
226
227# Ignore comments when computing similarities.
228ignore-comments=yes
229
230# Ignore docstrings when computing similarities.
231ignore-docstrings=yes
232
233# Ignore imports when computing similarities.
234ignore-imports=no
235
236# Minimum lines number of a similarity.
237min-similarity-lines=4
238
239
240[MISCELLANEOUS]
241
242# List of note tags to take in consideration, separated by a comma.
243notes=FIXME,
244      XXX,
245      TODO
246
247
248[STRING]
249
250# This flag controls whether the implicit-str-concat-in-sequence should
251# generate a warning on implicit string concatenation in sequences defined over
252# several lines.
253check-str-concat-over-line-jumps=no
254
255
256[BASIC]
257
258# Naming style matching correct argument names.
259argument-naming-style=snake_case
260
261# Regular expression matching correct argument names. Overrides argument-
262# naming-style.
263#argument-rgx=
264
265# Naming style matching correct attribute names.
266attr-naming-style=snake_case
267
268# Regular expression matching correct attribute names. Overrides attr-naming-
269# style.
270#attr-rgx=
271
272# Bad variable names which should always be refused, separated by a comma.
273bad-names=foo,
274          bar,
275          baz,
276          toto,
277          tutu,
278          tata
279
280# Naming style matching correct class attribute names.
281class-attribute-naming-style=any
282
283# Regular expression matching correct class attribute names. Overrides class-
284# attribute-naming-style.
285#class-attribute-rgx=
286
287# Naming style matching correct class names.
288class-naming-style=PascalCase
289
290# Regular expression matching correct class names. Overrides class-naming-
291# style.
292#class-rgx=
293
294# Naming style matching correct constant names.
295const-naming-style=UPPER_CASE
296
297# Regular expression matching correct constant names. Overrides const-naming-
298# style.
299const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
300
301# Minimum line length for functions/classes that require docstrings, shorter
302# ones are exempt.
303docstring-min-length=30
304
305# Naming style matching correct function names.
306function-naming-style=snake_case
307
308# Regular expression matching correct function names. Overrides function-
309# naming-style.
310#function-rgx=
311
312# Good variable names which should always be accepted, separated by a comma.
313good-names=i,
314           j,
315           k,
316           db,
317           ex,
318           fd,
319           id,
320           ok,
321           Run,
322           T,
323           _
324
325# Include a hint for the correct naming format with invalid-name.
326include-naming-hint=yes
327
328# Naming style matching correct inline iteration names.
329inlinevar-naming-style=any
330
331# Regular expression matching correct inline iteration names. Overrides
332# inlinevar-naming-style.
333#inlinevar-rgx=
334
335# Naming style matching correct method names.
336method-naming-style=snake_case
337
338# Regular expression matching correct method names. Overrides method-naming-
339# style.
340#method-rgx=
341
342# Naming style matching correct module names.
343module-naming-style=snake_case
344
345# Regular expression matching correct module names. Overrides module-naming-
346# style.
347#module-rgx=
348
349# Colon-delimited sets of names that determine each other's naming style when
350# the name regexes allow several styles.
351name-group=
352
353# Regular expression which should only match function or class names that do
354# not require a docstring.
355no-docstring-rgx=^_
356
357# List of decorators that produce properties, such as abc.abstractproperty. Add
358# to this list to register other decorators that produce valid properties.
359# These decorators are taken in consideration only for invalid-name.
360property-classes=abc.abstractproperty
361
362# Naming style matching correct variable names.
363variable-naming-style=snake_case
364
365# Regular expression matching correct variable names. Overrides variable-
366# naming-style.
367#variable-rgx=
368
369
370[TYPECHECK]
371
372# List of decorators that produce context managers, such as
373# contextlib.contextmanager. Add to this list to register other decorators that
374# produce valid context managers.
375contextmanager-decorators=contextlib.contextmanager
376
377# List of members which are set dynamically and missed by pylint inference
378# system, and so shouldn't trigger E1101 when accessed. Python regular
379# expressions are accepted.
380generated-members=descriptor_pb2.*,plugin_pb2.*
381
382# Tells whether missing members accessed in mixin class should be ignored. A
383# mixin class is detected if its name ends with "mixin" (case insensitive).
384ignore-mixin-members=yes
385
386# Tells whether to warn about missing members when the owner of the attribute
387# is inferred to be None.
388ignore-none=yes
389
390# This flag controls whether pylint should warn about no-member and similar
391# checks whenever an opaque object is returned when inferring. The inference
392# can return multiple potential results while evaluating a Python object, but
393# some branches might not be evaluated, which results in partial inference. In
394# that case, it might be useful to still emit no-member and other checks for
395# the rest of the inferred objects.
396ignore-on-opaque-inference=yes
397
398# List of class names for which member attributes should not be checked (useful
399# for classes with dynamically set attributes). This supports the use of
400# qualified names.
401ignored-classes=optparse.Values,
402                thread._local,
403                _thread._local,
404                pw_cli.envparse.EnvNamespace
405
406# List of module names for which member attributes should not be checked
407# (useful for modules/projects where namespaces are manipulated during runtime
408# and thus existing member attributes cannot be deduced by static analysis). It
409# supports qualified module names, as well as Unix pattern matching.
410ignored-modules=*_pb2
411
412# Show a hint with possible names when a member name was not found. The aspect
413# of finding the hint is based on edit distance.
414missing-member-hint=yes
415
416# The minimum edit distance a name should have in order to be considered a
417# similar match for a missing member name.
418missing-member-hint-distance=1
419
420# The total number of similar names that should be taken in consideration when
421# showing a hint for a missing member.
422missing-member-max-choices=1
423
424# List of decorators that change the signature of a decorated function.
425signature-mutators=
426
427
428[DESIGN]
429
430# Maximum number of arguments for function / method.
431max-args=10
432
433# Maximum number of attributes for a class (see R0902).
434max-attributes=11
435
436# Maximum number of boolean expressions in an if statement (see R0916).
437max-bool-expr=5
438
439# Maximum number of branch for function / method body.
440max-branches=25
441
442# Maximum number of locals for function / method body.
443max-locals=25
444
445# Maximum number of parents for a class (see R0901).
446max-parents=7
447
448# Maximum number of public methods for a class (see R0904).
449max-public-methods=25
450
451# Maximum number of return / yield for function / method body.
452max-returns=10
453
454# Maximum number of statements in function / method body.
455max-statements=100
456
457# Minimum number of public methods for a class (see R0903).
458min-public-methods=0
459
460
461[CLASSES]
462
463# List of method names used to declare (i.e. assign) instance attributes.
464defining-attr-methods=__init__,
465                      __new__,
466                      setUp,
467                      __post_init__
468
469# List of member names, which should be excluded from the protected access
470# warning.
471exclude-protected=_asdict,
472                  _fields,
473                  _replace,
474                  _source,
475                  _make
476
477# List of valid names for the first argument in a class method.
478valid-classmethod-first-arg=cls
479
480# List of valid names for the first argument in a metaclass class method.
481valid-metaclass-classmethod-first-arg=cls
482
483
484[IMPORTS]
485
486# List of modules that can be imported at any level, not just the top level
487# one.
488allow-any-import-level=
489
490# Allow wildcard imports from modules that define __all__.
491allow-wildcard-with-all=no
492
493# Analyse import fallback blocks. This can be used to support both Python 2 and
494# 3 compatible code, which means that the block might have code that exists
495# only in one or another interpreter, leading to false positives when analysed.
496analyse-fallback-blocks=no
497
498# Deprecated modules which should not be used, separated by a comma.
499deprecated-modules=optparse,tkinter.tix
500
501# Create a graph of external dependencies in the given file (report RP0402 must
502# not be disabled).
503ext-import-graph=
504
505# Create a graph of every (i.e. internal and external) dependencies in the
506# given file (report RP0402 must not be disabled).
507import-graph=
508
509# Create a graph of internal dependencies in the given file (report RP0402 must
510# not be disabled).
511int-import-graph=
512
513# Force import order to recognize a module as part of the standard
514# compatibility libraries.
515known-standard-library=
516
517# Force import order to recognize a module as part of a third party library.
518known-third-party=enchant
519
520# Couples of modules and preferred modules, separated by a comma.
521preferred-modules=
522
523
524[EXCEPTIONS]
525
526# Exceptions that will emit a warning when being caught. Defaults to
527# "BaseException, Exception".
528overgeneral-exceptions=builtins.BaseException,
529                       builtins.Exception
530