blob: 7b9c3c45cce2ab8bb289add8dedc6398c57480a7 [file] [log] [blame]
Craig Citro4572ff02015-05-01 09:14:07 -07001# PyLint config for apitools code.
2#
3# NOTES:
4#
5# - Rules for test / demo code are generated into 'pylintrc_reduced'
6# as deltas from this configuration by the 'run_pylint.py' script.
7#
8# - 'RATIONALE: API mapping' as a defense for non-default settings is
9# based on the fact that this library maps APIs which are outside our
10# control, and adhering to the out-of-the-box defaults would induce
11# breakage / complexity in those mappings
12#
13[MASTER]
14
15# Specify a configuration file.
16# DEFAULT: rcfile=
17
18# Python code to execute, usually for sys.path manipulation such as
19# pygtk.require().
20# DEFAULT: init-hook=
21
22# Profiled execution.
23# DEFAULT: profile=no
24
25# Add files or directories to the blacklist. They should be base names, not
26# paths.
27# DEFAULT: ignore=CVS
28# NOTE: This path must be relative due to the use of
29# os.walk in astroid.modutils.get_module_files.
30
31# Pickle collected data for later comparisons.
32# DEFAULT: persistent=yes
33
34# List of plugins (as comma separated values of python modules names) to load,
35# usually to register additional checkers.
36# DEFAULT: load-plugins=
37
38# DEPRECATED
39# DEFAULT: include-ids=no
40
41# DEPRECATED
42# DEFAULT: symbols=no
43
44
45[MESSAGES CONTROL]
46
Craig Citro4b147c42015-07-19 21:03:45 -070047# TODO: remove cyclic-import.
Craig Citro4572ff02015-05-01 09:14:07 -070048disable =
Craig Citro4b147c42015-07-19 21:03:45 -070049 cyclic-import,
Craig Citro4572ff02015-05-01 09:14:07 -070050 fixme,
51 import-error,
52 locally-disabled,
53 locally-enabled,
Craig Citro4572ff02015-05-01 09:14:07 -070054 no-member,
Craig Citro976dcb12015-09-18 13:49:53 -070055 no-name-in-module,
Craig Citro4572ff02015-05-01 09:14:07 -070056 no-self-use,
Craig Citro4572ff02015-05-01 09:14:07 -070057 super-on-old-class,
Matt Houglumc47b7652016-05-17 16:49:28 -070058 too-many-arguments,
Craig Citro7a3e28f2015-07-26 16:32:53 -070059 too-many-function-args,
Craig Citro4572ff02015-05-01 09:14:07 -070060
61
62[REPORTS]
63
64# Set the output format. Available formats are text, parseable, colorized, msvs
65# (visual studio) and html. You can also give a reporter class, eg
66# mypackage.mymodule.MyReporterClass.
67# DEFAULT: output-format=text
68
69# Put messages in a separate file for each module / package specified on the
70# command line instead of printing them on stdout. Reports (if any) will be
71# written in a file name "pylint_global.[txt|html]".
72# DEFAULT: files-output=no
73
74# Tells whether to display a full report or only the messages
75# DEFAULT: reports=yes
76# RATIONALE: run from Travis / tox, and don't need / want to parse output.
77reports=no
78
79# Python expression which should return a note less than 10 (10 is the highest
80# note). You have access to the variables errors warning, statement which
81# respectively contain the number of errors / warnings messages and the total
82# number of statements analyzed. This is used by the global evaluation report
83# (RP0004).
84# DEFAULT: evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
85
86# Add a comment according to your evaluation note. This is used by the global
87# evaluation report (RP0004).
88# DEFAULT: comment=no
89
90# Template used to display messages. This is a python new-style format string
91# used to format the message information. See doc for all details
92#msg-template=
93
94
95[SIMILARITIES]
96
97# Minimum lines number of a similarity.
98# DEFAULT: min-similarity-lines=4
Arthur D. Cherba518feea2016-01-01 12:42:55 -050099min-similarity-lines=15
Craig Citro4572ff02015-05-01 09:14:07 -0700100
101# Ignore comments when computing similarities.
102# DEFAULT: ignore-comments=yes
103
104# Ignore docstrings when computing similarities.
105# DEFAULT: ignore-docstrings=yes
106
107# Ignore imports when computing similarities.
108# DEFAULT: ignore-imports=no
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500109ignore-imports=yes
Craig Citro4572ff02015-05-01 09:14:07 -0700110
111
112[VARIABLES]
113
114# Tells whether we should check for unused import in __init__ files.
115# DEFAULT: init-import=no
116
117# A regular expression matching the name of dummy variables (i.e. expectedly
118# not used).
119dummy-variables-rgx=^\*{0,2}(_$|unused_|dummy_)
120
121
122# List of additional names supposed to be defined in builtins. Remember that
123# you should avoid to define new builtins when possible.
124# DEFAULT: additional-builtins=
125
126
127[LOGGING]
128
129# Logging modules to check that the string format arguments are in logging
130# function parameter format
131# DEFAULT: logging-modules=logging
132
133
134[FORMAT]
135
136# Maximum number of characters on a single line.
137# DEFAULT: max-line-length=80
138
139# Regexp for a line that is allowed to be longer than the limit.
140# DEFAULT: ignore-long-lines=^\s*(# )?<?https?://\S+>?$
141
142# Allow the body of an if to be on the same line as the test if there is no
143# else.
144# DEFAULT: single-line-if-stmt=no
145
146# List of optional constructs for which whitespace checking is disabled
147# DEFAULT: no-space-check=trailing-comma,dict-separator
148# RATIONALE: pylint ignores whitespace checks around the
149# constructs "dict-separator" (cases like {1:2}) and
150# "trailing-comma" (cases like {1: 2, }).
151# By setting "no-space-check" to empty whitespace checks will be
152# enforced around both constructs.
153no-space-check =
154
155# Maximum number of lines in a module
156# DEFAULT: max-module-lines=1000
157max-module-lines=1500
158
159# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
160# tab).
161# DEFAULT: indent-string=' '
162
163# Number of spaces of indent required inside a hanging or continued line.
164# DEFAULT: indent-after-paren=4
165
166
167[MISCELLANEOUS]
168
169# List of note tags to take in consideration, separated by a comma.
170# DEFAULT: notes=FIXME,XXX,TODO
171
172
173[BASIC]
Craig Citro4572ff02015-05-01 09:14:07 -0700174
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500175# Regular expression which should only match function or class names that do
176# not require a docstring.
177# DEFAULT: no-docstring-rgx=__.*__
Craig Citro4572ff02015-05-01 09:14:07 -0700178no-docstring-rgx=(__.*__|main)
179
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500180# Minimum line length for functions/classes that require docstrings, shorter
181# ones are exempt.
182# DEFAULT: docstring-min-length=-1
Craig Citro4572ff02015-05-01 09:14:07 -0700183docstring-min-length=10
184
185# Regular expression which should only match correct module names. The
186# leading underscore is sanctioned for private modules by Google's style
187# guide.
188module-rgx=^(_?[a-z][a-z0-9_]*)|__init__$
189
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500190# Regular expression matching correct constant names
191# DEFAULT: const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
Craig Citro4572ff02015-05-01 09:14:07 -0700192const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
193
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500194# Regular expression matching correct class attribute names
195# DEFAULT: class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
Craig Citro4572ff02015-05-01 09:14:07 -0700196class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
197
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500198# Regular expression matching correct class names
199# DEFAULT: class-rgx=[A-Z_][a-zA-Z0-9]+$
Craig Citro4572ff02015-05-01 09:14:07 -0700200class-rgx=^_?[A-Z][a-zA-Z0-9]*$
201
202# Regular expression which should only match correct function names.
203# 'camel_case' and 'snake_case' group names are used for consistency of naming
204# styles across functions and methods.
205function-rgx=^(?:(?P<camel_case>_?[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_?[a-z][a-z0-9_]*))$
206
207# Regular expression which should only match correct method names.
208# 'camel_case' and 'snake_case' group names are used for consistency of naming
209# styles across functions and methods. 'exempt' indicates a name which is
210# consistent with all naming styles.
211method-rgx=^(?:(?P<exempt>__[a-z0-9_]+__|next)|(?P<camel_case>_{0,2}[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_{0,2}[a-z][a-z0-9_]*))$
212
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500213# Regular expression matching correct attribute names
214# DEFAULT: attr-rgx=[a-z_][a-z0-9_]{2,30}$
Craig Citro4572ff02015-05-01 09:14:07 -0700215attr-rgx=^_{0,2}[a-z][a-z0-9_]*$
216
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500217# Regular expression matching correct argument names
218# DEFAULT: argument-rgx=[a-z_][a-z0-9_]{2,30}$
Craig Citro4572ff02015-05-01 09:14:07 -0700219argument-rgx=^[a-z][a-z0-9_]*$
220
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500221# Regular expression matching correct variable names
222# DEFAULT: variable-rgx=[a-z_][a-z0-9_]{2,30}$
Craig Citro4572ff02015-05-01 09:14:07 -0700223variable-rgx=^[a-z][a-z0-9_]*$
224
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500225# Regular expression matching correct inline iteration names
226# DEFAULT: inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
Craig Citro4572ff02015-05-01 09:14:07 -0700227inlinevar-rgx=^[a-z][a-z0-9_]*$
228
229# Good variable names which should always be accepted, separated by a comma
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500230# DEFAULT: good-names=i,j,k,ex,Run,_
Craig Citro4572ff02015-05-01 09:14:07 -0700231good-names=main,_
232
233# Bad variable names which should always be refused, separated by a comma
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500234# DEFAULT: bad-names=foo,bar,baz,toto,tutu,tata
Craig Citro4572ff02015-05-01 09:14:07 -0700235bad-names=
236
237# List of builtins function names that should not be used, separated by a comma
238# <http://go/python-style#Deprecated_Language_Features>
239bad-functions=input,apply,reduce
240
Craig Citro4572ff02015-05-01 09:14:07 -0700241
242[TYPECHECK]
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# DEFAULT: 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
251# DEFAULT: ignored-modules=
252
253# List of classes names for which member attributes should not be checked
254# (useful for classes with attributes dynamically set).
255# DEFAULT: ignored-classes=SQLObject
256
257# When zope mode is activated, add a predefined set of Zope acquired attributes
258# to generated-members.
259# DEFAULT: zope=no
260
261# List of members which are set dynamically and missed by pylint inference
262# system, and so shouldn't trigger E0201 when accessed. Python regular
263# expressions are accepted.
264# DEFAULT: generated-members=REQUEST,acl_users,aq_parent
265
266
267[IMPORTS]
268
269# Deprecated modules which should not be used, separated by a comma
270# DEFAULT: deprecated-modules=regsub,TERMIOS,Bastion,rexec
271
272# Create a graph of every (i.e. internal and external) dependencies in the
273# given file (report RP0402 must not be disabled)
274# DEFAULT: import-graph=
275
276# Create a graph of external dependencies in the given file (report RP0402 must
277# not be disabled)
278# DEFAULT: ext-import-graph=
279
280# Create a graph of internal dependencies in the given file (report RP0402 must
281# not be disabled)
282# DEFAULT: int-import-graph=
283
284
285[CLASSES]
286
287# List of interface methods to ignore, separated by a comma. This is used for
288# instance to not check methods defines in Zope's Interface base class.
289# DEFAULT: ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
290
291# List of method names used to declare (i.e. assign) instance attributes.
292# DEFAULT: defining-attr-methods=__init__,__new__,setUp
293
294# List of valid names for the first argument in a class method.
295# DEFAULT: valid-classmethod-first-arg=cls
296
297# List of valid names for the first argument in a metaclass class method.
298# DEFAULT: valid-metaclass-classmethod-first-arg=mcs
299
300
301[DESIGN]
302
303# Maximum number of arguments for function / method
304# DEFAULT: max-args=5
305# RATIONALE: API-mapping
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500306max-args = 14
Craig Citro4572ff02015-05-01 09:14:07 -0700307
308# Argument names that match this expression will be ignored. Default to name
309# with leading underscore
310# DEFAULT: ignored-argument-names=_.*
311
312# Maximum number of locals for function / method body
313# DEFAULT: max-locals=15
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500314max-locals=24
Craig Citro4572ff02015-05-01 09:14:07 -0700315
316# Maximum number of return / yield for function / method body
317# DEFAULT: max-returns=6
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500318max-returns=9
Craig Citro4572ff02015-05-01 09:14:07 -0700319
320# Maximum number of branch for function / method body
321# DEFAULT: max-branches=12
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500322max-branches=21
Craig Citro4572ff02015-05-01 09:14:07 -0700323
324# Maximum number of statements in function / method body
325# DEFAULT: max-statements=50
326
327# Maximum number of parents for a class (see R0901).
328# DEFAULT: max-parents=7
329
330# Maximum number of attributes for a class (see R0902).
331# DEFAULT: max-attributes=7
332# RATIONALE: API mapping
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500333max-attributes=19
Craig Citro4572ff02015-05-01 09:14:07 -0700334
335# Minimum number of public methods for a class (see R0903).
336# DEFAULT: min-public-methods=2
337# RATIONALE: context mgrs may have *no* public methods
338min-public-methods=0
339
340# Maximum number of public methods for a class (see R0904).
341# DEFAULT: max-public-methods=20
342# RATIONALE: API mapping
343max-public-methods=40
344
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500345[ELIF]
346max-nested-blocks=6
Craig Citro4572ff02015-05-01 09:14:07 -0700347
348[EXCEPTIONS]
349
350# Exceptions that will emit a warning when being caught. Defaults to
351# "Exception"
352# DEFAULT: overgeneral-exceptions=Exception