|
| 1 | +# copybara:strip_begin(internal) |
| 2 | +# This is based on http://google3/devtools/gpylint/config/base/rc |
| 3 | +# copybara:strip_end |
| 4 | + |
| 5 | + |
| 6 | +# Default configuration for pylint, which should pass for all (incremental) changes. |
| 7 | +# See CONTRIBUTING.md for more. |
| 8 | + |
| 9 | +[MESSAGES CONTROL] |
| 10 | +# List of checkers and warnings to enable. |
| 11 | +enable=indexing-exception,old-raise-syntax |
| 12 | + |
| 13 | +disable=abstract-method, |
| 14 | + attribute-defined-outside-init, |
| 15 | + bad-option-value, |
| 16 | + c-extension-no-member, |
| 17 | + design, |
| 18 | + file-ignored, |
| 19 | + fixme, |
| 20 | + global-statement, |
| 21 | + invalid-metaclass, |
| 22 | + locally-disabled, |
| 23 | + locally-enabled, |
| 24 | + misplaced-comparison-constant, |
| 25 | + no-else-break, |
| 26 | + no-else-continue, |
| 27 | + no-else-raise, |
| 28 | + no-else-return, |
| 29 | + no-self-use, |
| 30 | + pointless-except, |
| 31 | + redundant-u-string-prefix, |
| 32 | + similarities, |
| 33 | + star-args, |
| 34 | + suppressed-message, |
| 35 | + trailing-newlines, |
| 36 | + ungrouped-imports, |
| 37 | + unnecessary-pass, |
| 38 | + unspecified-encoding, |
| 39 | + unsubscriptable-object, |
| 40 | + useless-else-on-loop, |
| 41 | + useless-object-inheritance, |
| 42 | + useless-suppression, |
| 43 | + |
| 44 | +[BASIC] |
| 45 | + |
| 46 | +# Regular expression which should only match the name |
| 47 | +# of functions or classes which do not require a docstring. |
| 48 | +no-docstring-rgx=(__.*__|main) |
| 49 | + |
| 50 | +# Min length in lines of a function that requires a docstring. |
| 51 | +docstring-min-length=12 |
| 52 | + |
| 53 | +# Regular expression which should only match correct module names. The |
| 54 | +# leading underscore is sanctioned for private modules by Google's style |
| 55 | +# guide. |
| 56 | +# |
| 57 | +# There are exceptions to the basic rule (_?[a-z][a-z0-9_]*) to cover |
| 58 | +# requirements of Python's module system and of the presubmit framework. |
| 59 | +module-rgx=^(_?[a-z][a-z0-9_]*)|__init__|PRESUBMIT|PRESUBMIT_unittest$ |
| 60 | + |
| 61 | +# Regular expression which should only match correct module level names |
| 62 | +const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$ |
| 63 | + |
| 64 | +# Regular expression which should only match correct class attribute |
| 65 | +class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$ |
| 66 | + |
| 67 | +# Regular expression which should only match correct class names |
| 68 | +class-rgx=^_?[A-Z][a-zA-Z0-9]*$ |
| 69 | + |
| 70 | +# Regular expression which should only match correct function names. |
| 71 | +# 'PascalCase' and 'snake_case' group names are used for consistency of naming |
| 72 | +# styles across functions and methods. |
| 73 | +function-rgx=^(?:(?P<PascalCase>_?[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_?[a-z][a-z0-9_]*))$ |
| 74 | + |
| 75 | +# Regular expression which should only match correct method names. |
| 76 | +# 'PascalCase' and 'snake_case' group names are used for consistency of naming |
| 77 | +# styles across functions and methods. 'exempt' indicates a name which is |
| 78 | +# consistent with all naming styles. |
| 79 | +method-rgx=(?x)^(?:(?P<exempt>_[a-z0-9_]+__|next)|(?P<PascalCase>_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P<snake_case>_{0,2}[a-z][a-z0-9_]*))$ |
| 80 | + |
| 81 | +# Regular expression which should only match correct instance attribute names |
| 82 | +attr-rgx=^_{0,2}[a-z][a-z0-9_]*$ |
| 83 | + |
| 84 | +# Regular expression which should only match correct argument names |
| 85 | +argument-rgx=^[a-z][a-z0-9_]*$ |
| 86 | + |
| 87 | +# Regular expression which should only match correct variable names |
| 88 | +variable-rgx=^[a-z][a-z0-9_]*$ |
| 89 | + |
| 90 | +# Regular expression which should only match correct list comprehension / |
| 91 | +# generator expression variable names |
| 92 | +inlinevar-rgx=^[a-z][a-z0-9_]*$ |
| 93 | + |
| 94 | +# Regular expression which should only match correct TypeVar names |
| 95 | +typevar-rgx=^_{0,2}(?:[^\W\da-z_]+|(?:[^\W\da-z_]+[^\WA-Z_]+)+T?)(?:_co(?:ntra)?)?$ |
| 96 | + |
| 97 | +# Good variable names which should always be accepted, separated by a comma |
| 98 | +good-names=main,_ |
| 99 | + |
| 100 | +# List of decorators that define properties, such as abc.abstractproperty. |
| 101 | +property-classes=abc.abstractproperty,functools.cached_property,google3.pyglib.function_utils.cached.property,cached_property.cached_property,cached_property.threaded_cached_property,cached_property.cached_property_with_ttl,cached_property.threaded_cached_property_with_ttl,werkzeug.utils.cached_property |
| 102 | + |
| 103 | +[VARIABLES] |
| 104 | + |
| 105 | +# Tells whether we should check for unused import in __init__ files. |
| 106 | +init-import=no |
| 107 | + |
| 108 | +# A regular expression matching names used for dummy variables (i.e. not used). |
| 109 | +dummy-variables-rgx=^\*{0,2}(_$|unused_|dummy_) |
| 110 | + |
| 111 | +# List of additional names supposed to be defined in builtins. Remember that |
| 112 | +# you should avoid to define new builtins when possible. |
| 113 | +additional-builtins= |
| 114 | + |
| 115 | +# List of modules that are allowed to redefine builtins. |
| 116 | +redefining-builtins-modules=six,six.moves,past.builtins,future.builtins,functools |
| 117 | + |
| 118 | +[STRING] |
| 119 | + |
| 120 | +# This flag controls whether the implicit-str-concat should |
| 121 | +# generate a warning on implicit string concatenation in sequences defined over |
| 122 | +# several lines. |
| 123 | +check-str-concat-over-line-jumps=yes |
| 124 | + |
| 125 | +[CLASSES] |
| 126 | + |
| 127 | +# List of method names used to declare (i.e. assign) instance attributes. |
| 128 | +defining-attr-methods=__init__,__new__,setUp |
| 129 | + |
| 130 | +# "class_" is also a valid for the first argument to a class method. |
| 131 | +valid-classmethod-first-arg=cls,class_ |
| 132 | + |
| 133 | + |
| 134 | +[FORMAT] |
| 135 | + |
| 136 | +# Maximum number of characters on a single line. |
| 137 | +max-line-length=80 |
| 138 | + |
| 139 | +# Regexp for a line that is allowed to be longer than the limit. |
| 140 | +# This "ignore" regex is today composed of: |
| 141 | +# (1) p4 expansion $Id$ lines |
| 142 | +# (2) Depot paths for go/ifthisthenthatlint directives. |
| 143 | +# (3) Long string constants not containing whitespaces. This is needed now we |
| 144 | +# have switched Pyformat to use Pyink, and it would wrap strings constants |
| 145 | +# with a narrow range of lengths (less than 80 - indentation) in parens. |
| 146 | +# This causes GPylint to complain otherwise allowed per |
| 147 | +# go/pystyle#line-length. See b/262137806 for more information. |
| 148 | +# Other lines might be allowed to be long by gpylint.pyformat_filter: see that |
| 149 | +# module for more information. |
| 150 | +ignore-long-lines=(?x)(\$Id:\s\/\/depot\/.+\#\d+\s\$|^\s*\#\ LINT\.ThenChange|^\s*\w+\ =\ (?P<quote>['"])\S+(?P=quote)$) |
| 151 | + |
| 152 | +# Maximum number of lines in a module |
| 153 | +max-module-lines=99999 |
| 154 | + |
| 155 | +# String used as indentation unit. We differ from PEP8's normal 4 spaces. |
| 156 | +indent-string=' ' |
| 157 | + |
| 158 | +# Do not warn about multiple statements on a single line for constructs like |
| 159 | +# if test: stmt |
| 160 | +single-line-if-stmt=y |
0 commit comments