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