blob: b4c45775b824c638e60b26ea011e591d60977aae [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,
Craig Citro7a3e28f2015-07-26 16:32:53 -070058 too-many-function-args,
Craig Citro4572ff02015-05-01 09:14:07 -070059
60
61[REPORTS]
62
63# Set the output format. Available formats are text, parseable, colorized, msvs
64# (visual studio) and html. You can also give a reporter class, eg
65# mypackage.mymodule.MyReporterClass.
66# DEFAULT: output-format=text
67
68# Put messages in a separate file for each module / package specified on the
69# command line instead of printing them on stdout. Reports (if any) will be
70# written in a file name "pylint_global.[txt|html]".
71# DEFAULT: files-output=no
72
73# Tells whether to display a full report or only the messages
74# DEFAULT: reports=yes
75# RATIONALE: run from Travis / tox, and don't need / want to parse output.
76reports=no
77
78# Python expression which should return a note less than 10 (10 is the highest
79# note). You have access to the variables errors warning, statement which
80# respectively contain the number of errors / warnings messages and the total
81# number of statements analyzed. This is used by the global evaluation report
82# (RP0004).
83# DEFAULT: evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
84
85# Add a comment according to your evaluation note. This is used by the global
86# evaluation report (RP0004).
87# DEFAULT: comment=no
88
89# Template used to display messages. This is a python new-style format string
90# used to format the message information. See doc for all details
91#msg-template=
92
93
94[SIMILARITIES]
95
96# Minimum lines number of a similarity.
97# DEFAULT: min-similarity-lines=4
Arthur D. Cherba518feea2016-01-01 12:42:55 -050098min-similarity-lines=15
Craig Citro4572ff02015-05-01 09:14:07 -070099
100# Ignore comments when computing similarities.
101# DEFAULT: ignore-comments=yes
102
103# Ignore docstrings when computing similarities.
104# DEFAULT: ignore-docstrings=yes
105
106# Ignore imports when computing similarities.
107# DEFAULT: ignore-imports=no
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500108ignore-imports=yes
Craig Citro4572ff02015-05-01 09:14:07 -0700109
110
111[VARIABLES]
112
113# Tells whether we should check for unused import in __init__ files.
114# DEFAULT: init-import=no
115
116# A regular expression matching the name of dummy variables (i.e. expectedly
117# not used).
118dummy-variables-rgx=^\*{0,2}(_$|unused_|dummy_)
119
120
121# List of additional names supposed to be defined in builtins. Remember that
122# you should avoid to define new builtins when possible.
123# DEFAULT: additional-builtins=
124
125
126[LOGGING]
127
128# Logging modules to check that the string format arguments are in logging
129# function parameter format
130# DEFAULT: logging-modules=logging
131
132
133[FORMAT]
134
135# Maximum number of characters on a single line.
136# DEFAULT: max-line-length=80
137
138# Regexp for a line that is allowed to be longer than the limit.
139# DEFAULT: ignore-long-lines=^\s*(# )?<?https?://\S+>?$
140
141# Allow the body of an if to be on the same line as the test if there is no
142# else.
143# DEFAULT: single-line-if-stmt=no
144
145# List of optional constructs for which whitespace checking is disabled
146# DEFAULT: no-space-check=trailing-comma,dict-separator
147# RATIONALE: pylint ignores whitespace checks around the
148# constructs "dict-separator" (cases like {1:2}) and
149# "trailing-comma" (cases like {1: 2, }).
150# By setting "no-space-check" to empty whitespace checks will be
151# enforced around both constructs.
152no-space-check =
153
154# Maximum number of lines in a module
155# DEFAULT: max-module-lines=1000
156max-module-lines=1500
157
158# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
159# tab).
160# DEFAULT: indent-string=' '
161
162# Number of spaces of indent required inside a hanging or continued line.
163# DEFAULT: indent-after-paren=4
164
165
166[MISCELLANEOUS]
167
168# List of note tags to take in consideration, separated by a comma.
169# DEFAULT: notes=FIXME,XXX,TODO
170
171
172[BASIC]
Craig Citro4572ff02015-05-01 09:14:07 -0700173
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500174# Regular expression which should only match function or class names that do
175# not require a docstring.
176# DEFAULT: no-docstring-rgx=__.*__
Craig Citro4572ff02015-05-01 09:14:07 -0700177no-docstring-rgx=(__.*__|main)
178
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500179# Minimum line length for functions/classes that require docstrings, shorter
180# ones are exempt.
181# DEFAULT: docstring-min-length=-1
Craig Citro4572ff02015-05-01 09:14:07 -0700182docstring-min-length=10
183
184# Regular expression which should only match correct module names. The
185# leading underscore is sanctioned for private modules by Google's style
186# guide.
187module-rgx=^(_?[a-z][a-z0-9_]*)|__init__$
188
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500189# Regular expression matching correct constant names
190# DEFAULT: const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
Craig Citro4572ff02015-05-01 09:14:07 -0700191const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
192
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500193# Regular expression matching correct class attribute names
194# DEFAULT: class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
Craig Citro4572ff02015-05-01 09:14:07 -0700195class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$
196
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500197# Regular expression matching correct class names
198# DEFAULT: class-rgx=[A-Z_][a-zA-Z0-9]+$
Craig Citro4572ff02015-05-01 09:14:07 -0700199class-rgx=^_?[A-Z][a-zA-Z0-9]*$
200
201# Regular expression which should only match correct function names.
202# 'camel_case' and 'snake_case' group names are used for consistency of naming
203# styles across functions and methods.
204function-rgx=^(?:(?P<camel_case>_?[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_?[a-z][a-z0-9_]*))$
205
206# Regular expression which should only match correct method names.
207# 'camel_case' and 'snake_case' group names are used for consistency of naming
208# styles across functions and methods. 'exempt' indicates a name which is
209# consistent with all naming styles.
210method-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_]*))$
211
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500212# Regular expression matching correct attribute names
213# DEFAULT: attr-rgx=[a-z_][a-z0-9_]{2,30}$
Craig Citro4572ff02015-05-01 09:14:07 -0700214attr-rgx=^_{0,2}[a-z][a-z0-9_]*$
215
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500216# Regular expression matching correct argument names
217# DEFAULT: argument-rgx=[a-z_][a-z0-9_]{2,30}$
Craig Citro4572ff02015-05-01 09:14:07 -0700218argument-rgx=^[a-z][a-z0-9_]*$
219
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500220# Regular expression matching correct variable names
221# DEFAULT: variable-rgx=[a-z_][a-z0-9_]{2,30}$
Craig Citro4572ff02015-05-01 09:14:07 -0700222variable-rgx=^[a-z][a-z0-9_]*$
223
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500224# Regular expression matching correct inline iteration names
225# DEFAULT: inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
Craig Citro4572ff02015-05-01 09:14:07 -0700226inlinevar-rgx=^[a-z][a-z0-9_]*$
227
228# Good variable names which should always be accepted, separated by a comma
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500229# DEFAULT: good-names=i,j,k,ex,Run,_
Craig Citro4572ff02015-05-01 09:14:07 -0700230good-names=main,_
231
232# Bad variable names which should always be refused, separated by a comma
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500233# DEFAULT: bad-names=foo,bar,baz,toto,tutu,tata
Craig Citro4572ff02015-05-01 09:14:07 -0700234bad-names=
235
236# List of builtins function names that should not be used, separated by a comma
237# <http://go/python-style#Deprecated_Language_Features>
238bad-functions=input,apply,reduce
239
240# TEMPORARY
241no-docstring-rgx=.*
242
243
244[TYPECHECK]
245
246# Tells whether missing members accessed in mixin class should be ignored. A
247# mixin class is detected if its name ends with "mixin" (case insensitive).
248# DEFAULT: ignore-mixin-members=yes
249
250# List of module names for which member attributes should not be checked
251# (useful for modules/projects where namespaces are manipulated during runtime
252# and thus existing member attributes cannot be deduced by static analysis
253# DEFAULT: ignored-modules=
254
255# List of classes names for which member attributes should not be checked
256# (useful for classes with attributes dynamically set).
257# DEFAULT: ignored-classes=SQLObject
258
259# When zope mode is activated, add a predefined set of Zope acquired attributes
260# to generated-members.
261# DEFAULT: zope=no
262
263# List of members which are set dynamically and missed by pylint inference
264# system, and so shouldn't trigger E0201 when accessed. Python regular
265# expressions are accepted.
266# DEFAULT: generated-members=REQUEST,acl_users,aq_parent
267
268
269[IMPORTS]
270
271# Deprecated modules which should not be used, separated by a comma
272# DEFAULT: deprecated-modules=regsub,TERMIOS,Bastion,rexec
273
274# Create a graph of every (i.e. internal and external) dependencies in the
275# given file (report RP0402 must not be disabled)
276# DEFAULT: import-graph=
277
278# Create a graph of external dependencies in the given file (report RP0402 must
279# not be disabled)
280# DEFAULT: ext-import-graph=
281
282# Create a graph of internal dependencies in the given file (report RP0402 must
283# not be disabled)
284# DEFAULT: int-import-graph=
285
286
287[CLASSES]
288
289# List of interface methods to ignore, separated by a comma. This is used for
290# instance to not check methods defines in Zope's Interface base class.
291# DEFAULT: ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
292
293# List of method names used to declare (i.e. assign) instance attributes.
294# DEFAULT: defining-attr-methods=__init__,__new__,setUp
295
296# List of valid names for the first argument in a class method.
297# DEFAULT: valid-classmethod-first-arg=cls
298
299# List of valid names for the first argument in a metaclass class method.
300# DEFAULT: valid-metaclass-classmethod-first-arg=mcs
301
302
303[DESIGN]
304
305# Maximum number of arguments for function / method
306# DEFAULT: max-args=5
307# RATIONALE: API-mapping
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500308max-args = 14
Craig Citro4572ff02015-05-01 09:14:07 -0700309
310# Argument names that match this expression will be ignored. Default to name
311# with leading underscore
312# DEFAULT: ignored-argument-names=_.*
313
314# Maximum number of locals for function / method body
315# DEFAULT: max-locals=15
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500316max-locals=24
Craig Citro4572ff02015-05-01 09:14:07 -0700317
318# Maximum number of return / yield for function / method body
319# DEFAULT: max-returns=6
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500320max-returns=9
Craig Citro4572ff02015-05-01 09:14:07 -0700321
322# Maximum number of branch for function / method body
323# DEFAULT: max-branches=12
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500324max-branches=21
Craig Citro4572ff02015-05-01 09:14:07 -0700325
326# Maximum number of statements in function / method body
327# DEFAULT: max-statements=50
328
329# Maximum number of parents for a class (see R0901).
330# DEFAULT: max-parents=7
331
332# Maximum number of attributes for a class (see R0902).
333# DEFAULT: max-attributes=7
334# RATIONALE: API mapping
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500335max-attributes=19
Craig Citro4572ff02015-05-01 09:14:07 -0700336
337# Minimum number of public methods for a class (see R0903).
338# DEFAULT: min-public-methods=2
339# RATIONALE: context mgrs may have *no* public methods
340min-public-methods=0
341
342# Maximum number of public methods for a class (see R0904).
343# DEFAULT: max-public-methods=20
344# RATIONALE: API mapping
345max-public-methods=40
346
Arthur D. Cherba518feea2016-01-01 12:42:55 -0500347[ELIF]
348max-nested-blocks=6
Craig Citro4572ff02015-05-01 09:14:07 -0700349
350[EXCEPTIONS]
351
352# Exceptions that will emit a warning when being caught. Defaults to
353# "Exception"
354# DEFAULT: overgeneral-exceptions=Exception