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