• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This Pylint rcfile contains a best-effort configuration to uphold the
2# best-practices and style described in the Google Python style guide:
3#   https://google.github.io/styleguide/pyguide.html
4#
5# Its canonical open-source location is:
6#   https://google.github.io/styleguide/pylintrc
7
8[MASTER]
9
10# Files or directories to be skipped. They should be base names, not paths.
11ignore=third_party
12
13# Files or directories matching the regex patterns are skipped. The regex
14# matches against base names, not paths.
15ignore-patterns=
16
17# Pickle collected data for later comparisons.
18persistent=no
19
20# List of plugins (as comma separated values of python modules names) to load,
21# usually to register additional checkers.
22load-plugins=
23
24# Use multiple processes to speed up Pylint.
25jobs=4
26
27# Allow loading of arbitrary C extensions. Extensions are imported into the
28# active Python interpreter and may run arbitrary code.
29unsafe-load-any-extension=no
30
31
32[MESSAGES CONTROL]
33
34# Only show warnings with the listed confidence levels. Leave empty to show
35# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
36confidence=
37
38# Enable the message, report, category or checker with the given id(s). You can
39# either give multiple identifier separated by comma (,) or put this option
40# multiple time (only on the command line, not in the configuration file where
41# it should appear only once). See also the "--disable" option for examples.
42#enable=
43
44# Disable the message, report, category or checker with the given id(s). You
45# can either give multiple identifiers separated by comma (,) or put this
46# option multiple times (only on the command line, not in the configuration
47# file where it should appear only once).You can also use "--disable=all" to
48# disable everything first and then reenable specific checks. For example, if
49# you want to run only the similarities checker, you can use "--disable=all
50# --enable=similarities". If you want to run only the classes checker, but have
51# no Warning level messages displayed, use"--disable=all --enable=classes
52# --disable=W"
53disable=abstract-method,
54        apply-builtin,
55        arguments-differ,
56        attribute-defined-outside-init,
57        backtick,
58        bad-option-value,
59        basestring-builtin,
60        buffer-builtin,
61        c-extension-no-member,
62        consider-using-enumerate,
63        cmp-builtin,
64        cmp-method,
65        coerce-builtin,
66        coerce-method,
67        delslice-method,
68        div-method,
69        duplicate-code,
70        eq-without-hash,
71        execfile-builtin,
72        file-builtin,
73        filter-builtin-not-iterating,
74        fixme,
75        getslice-method,
76        global-statement,
77        hex-method,
78        idiv-method,
79        implicit-str-concat,
80        import-error,
81        import-self,
82        import-star-module-level,
83        inconsistent-return-statements,
84        input-builtin,
85        intern-builtin,
86        invalid-str-codec,
87        locally-disabled,
88        long-builtin,
89        long-suffix,
90        map-builtin-not-iterating,
91        misplaced-comparison-constant,
92        missing-function-docstring,
93        metaclass-assignment,
94        missing-class-docstring, # added
95        missing-module-docstring, # added
96        next-method-called,
97        next-method-defined,
98        no-absolute-import,
99        no-else-break,
100        no-else-continue,
101        no-else-raise,
102        no-else-return,
103        no-init,  # added
104        no-member,
105        no-name-in-module,
106        no-self-use,
107        nonzero-method,
108        oct-method,
109        old-division,
110        old-ne-operator,
111        old-octal-literal,
112        old-raise-syntax,
113        parameter-unpacking,
114        print-statement,
115        raising-string,
116        range-builtin-not-iterating,
117        raw_input-builtin,
118        rdiv-method,
119        reduce-builtin,
120        relative-import,
121        reload-builtin,
122        round-builtin,
123        setslice-method,
124        signature-differs,
125        standarderror-builtin,
126        suppressed-message,
127        sys-max-int,
128        too-few-public-methods,
129        too-many-ancestors,
130        too-many-arguments,
131        too-many-boolean-expressions,
132        too-many-branches,
133        too-many-instance-attributes,
134        too-many-locals,
135        too-many-nested-blocks,
136        too-many-positional-arguments,
137        too-many-public-methods,
138        too-many-return-statements,
139        too-many-statements,
140        trailing-newlines,
141        unichr-builtin,
142        unicode-builtin,
143        unnecessary-pass,
144        unpacking-in-except,
145        useless-else-on-loop,
146        useless-object-inheritance,
147        useless-suppression,
148        using-cmp-argument,
149        # wrong-import-order,
150        xrange-builtin,
151        zip-builtin-not-iterating,
152
153
154[REPORTS]
155
156# Set the output format. Available formats are text, parseable, colorized, msvs
157# (visual studio) and html. You can also give a reporter class, eg
158# mypackage.mymodule.MyReporterClass.
159output-format=text
160
161# Tells whether to display a full report or only the messages
162reports=no
163
164# Python expression which should return a note less than 10 (10 is the highest
165# note). You have access to the variables errors warning, statement which
166# respectively contain the number of errors / warnings messages and the total
167# number of statements analyzed. This is used by the global evaluation report
168# (RP0004).
169evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
170
171# Template used to display messages. This is a python new-style format string
172# used to format the message information. See doc for all details
173#msg-template=
174
175
176[BASIC]
177
178# Good variable names which should always be accepted, separated by a comma
179good-names=main,_
180
181# Bad variable names which should always be refused, separated by a comma
182bad-names=
183
184# Colon-delimited sets of names that determine each other's naming style when
185# the name regexes allow several styles.
186name-group=
187
188# Include a hint for the correct naming format with invalid-name
189include-naming-hint=no
190
191# List of decorators that produce properties, such as abc.abstractproperty. Add
192# to this list to register other decorators that produce valid properties.
193property-classes=abc.abstractproperty,cached_property.cached_property,cached_property.threaded_cached_property,cached_property.cached_property_with_ttl,cached_property.threaded_cached_property_with_ttl
194
195# Regular expression matching correct function names
196function-rgx=^(?:(?P<exempt>setUp|tearDown|setUpModule|tearDownModule)|(?P<camel_case>_?[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_?[a-z][a-z0-9_]*))$
197
198# Regular expression matching correct variable names
199variable-rgx=^[a-z][a-z0-9_]*$
200
201# Regular expression matching correct constant names
202const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
203
204# Regular expression matching correct attribute names
205attr-rgx=^_{0,2}[a-z][a-z0-9_]*$
206
207# Regular expression matching correct argument names
208argument-rgx=^[a-z][a-z0-9_]*$
209
210# Regular expression matching correct class attribute names
211class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
212
213# Regular expression matching correct inline iteration names
214inlinevar-rgx=^[a-z][a-z0-9_]*$
215
216# Regular expression matching correct class names
217class-rgx=^_?[A-Z][a-zA-Z0-9]*$
218
219# Regular expression matching correct module names
220module-rgx=^(_?[a-z][a-z0-9_]*|__init__|PRESUBMIT)$
221
222# Regular expression matching correct method names
223method-rgx=(?x)^(?:(?P<exempt>_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P<camel_case>_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P<snake_case>_{0,2}[a-z][a-z0-9_]*))$
224
225# Regular expression which should only match function or class names that do
226# not require a docstring.
227no-docstring-rgx=(__.*__|main|test.*|.*test|.*Test)$
228
229# Minimum line length for functions/classes that require docstrings, shorter
230# ones are exempt.
231docstring-min-length=10
232
233
234[TYPECHECK]
235
236# List of decorators that produce context managers, such as
237# contextlib.contextmanager. Add to this list to register other decorators that
238# produce valid context managers.
239contextmanager-decorators=contextlib.contextmanager,contextlib2.contextmanager
240
241# Tells whether missing members accessed in mixin class should be ignored. A
242# mixin class is detected if its name ends with "mixin" (case insensitive).
243ignore-mixin-members=yes
244
245# List of module names for which member attributes should not be checked
246# (useful for modules/projects where namespaces are manipulated during runtime
247# and thus existing member attributes cannot be deduced by static analysis. It
248# supports qualified module names, as well as Unix pattern matching.
249ignored-modules=
250
251# List of class names for which member attributes should not be checked (useful
252# for classes with dynamically set attributes). This supports the use of
253# qualified names.
254ignored-classes=optparse.Values,thread._local,_thread._local
255
256# List of members which are set dynamically and missed by pylint inference
257# system, and so shouldn't trigger E1101 when accessed. Python regular
258# expressions are accepted.
259generated-members=
260
261
262[FORMAT]
263
264# Maximum number of characters on a single line.
265max-line-length=80
266
267# TODO(https://github.com/PyCQA/pylint/issues/3352): Direct pylint to exempt
268# lines made too long by directives to pytype.
269
270# Regexp for a line that is allowed to be longer than the limit.
271ignore-long-lines=(?x)(
272  .*https?://\S+>?$|
273  ^\s*(from\s+\S+\s+)?import\s+.+$|
274  .*\spylint:\sdisable=\S+$|
275  .*\spytype:\sdisable=\S+$)
276
277# Allow the body of an if to be on the same line as the test if there is no
278# else.
279single-line-if-stmt=yes
280
281# Maximum number of lines in a module
282max-module-lines=99999
283
284# String used as indentation unit.  The internal Google style guide mandates 2
285# spaces.  Google's externaly-published style guide says 4, consistent with
286# PEP 8.  Here, we use 2 spaces, for conformity with many open-sourced Google
287# projects (like TensorFlow).
288indent-string='  '
289
290# Number of spaces of indent required inside a hanging  or continued line.
291indent-after-paren=4
292
293# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
294expected-line-ending-format=
295
296
297[MISCELLANEOUS]
298
299# List of note tags to take in consideration, separated by a comma.
300notes=TODO
301
302
303[STRING]
304
305# This flag controls whether inconsistent-quotes generates a warning when the
306# character used as a quote delimiter is used inconsistently within a module.
307check-quote-consistency=yes
308
309
310[VARIABLES]
311
312# Tells whether we should check for unused import in __init__ files.
313init-import=no
314
315# A regular expression matching the name of dummy variables (i.e. expectedly
316# not used).
317dummy-variables-rgx=^\*{0,2}(_$|unused_|dummy_)
318
319# List of additional names supposed to be defined in builtins. Remember that
320# you should avoid to define new builtins when possible.
321additional-builtins=
322
323# List of strings which can identify a callback function by name. A callback
324# name must start or end with one of those strings.
325callbacks=cb_,_cb
326
327# List of qualified module names which can have objects that can redefine
328# builtins.
329redefining-builtins-modules=six,six.moves,past.builtins,future.builtins,functools
330
331
332[LOGGING]
333
334# Logging modules to check that the string format arguments are in logging
335# function parameter format
336logging-modules=logging,absl.logging,tensorflow.io.logging
337
338
339[SIMILARITIES]
340
341# Minimum lines number of a similarity.
342min-similarity-lines=4
343
344# Ignore comments when computing similarities.
345ignore-comments=yes
346
347# Ignore docstrings when computing similarities.
348ignore-docstrings=yes
349
350# Ignore imports when computing similarities.
351ignore-imports=no
352
353
354[SPELLING]
355
356# Spelling dictionary name. Available dictionaries: none. To make it working
357# install python-enchant package.
358spelling-dict=
359
360# List of comma separated words that should not be checked.
361spelling-ignore-words=
362
363# A path to a file that contains private dictionary; one word per line.
364spelling-private-dict-file=
365
366# Tells whether to store unknown words to indicated private dictionary in
367# --spelling-private-dict-file option instead of raising a message.
368spelling-store-unknown-words=no
369
370
371[IMPORTS]
372
373# Deprecated modules which should not be used, separated by a comma
374deprecated-modules=regsub,
375                   TERMIOS,
376                   Bastion,
377                   rexec,
378                   sets
379
380# Create a graph of every (i.e. internal and external) dependencies in the
381# given file (report RP0402 must not be disabled)
382import-graph=
383
384# Create a graph of external dependencies in the given file (report RP0402 must
385# not be disabled)
386ext-import-graph=
387
388# Create a graph of internal dependencies in the given file (report RP0402 must
389# not be disabled)
390int-import-graph=
391
392# Force import order to recognize a module as part of the standard
393# compatibility libraries.
394known-standard-library=
395
396# Force import order to recognize a module as part of a third party library.
397known-third-party=enchant, absl
398
399# Analyse import fallback blocks. This can be used to support both Python 2 and
400# 3 compatible code, which means that the block might have code that exists
401# only in one or another interpreter, leading to false positives when analysed.
402analyse-fallback-blocks=no
403
404
405[CLASSES]
406
407# List of method names used to declare (i.e. assign) instance attributes.
408defining-attr-methods=__init__,
409                      __new__,
410                      setUp
411
412# List of member names, which should be excluded from the protected access
413# warning.
414exclude-protected=_asdict,
415                  _fields,
416                  _replace,
417                  _source,
418                  _make
419
420# List of valid names for the first argument in a class method.
421valid-classmethod-first-arg=cls,
422                            class_
423
424# List of valid names for the first argument in a metaclass class method.
425valid-metaclass-classmethod-first-arg=mcs
426
427
428[EXCEPTIONS]
429
430# Exceptions that will emit a warning when being caught. Defaults to
431# "Exception"
432overgeneral-exceptions=builtins.StandardError,
433                       builtins.Exception,
434                       builtins.BaseException
435