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