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