xref: /aosp_15_r20/external/autotest/utils/pylintrc (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1*9c5db199SXin Li# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2*9c5db199SXin Li# Use of this source code is governed by a BSD-style license that can be
3*9c5db199SXin Li# found in the LICENSE file.
4*9c5db199SXin Li
5*9c5db199SXin Li[MASTER]
6*9c5db199SXin Li
7*9c5db199SXin Li# Specify a configuration file.
8*9c5db199SXin Li#rcfile=
9*9c5db199SXin Li
10*9c5db199SXin Li# Python code to execute, usually for sys.path manipulation such as
11*9c5db199SXin Li# pygtk.require().
12*9c5db199SXin Li#init-hook=
13*9c5db199SXin Li
14*9c5db199SXin Li# Profiled execution.
15*9c5db199SXin Li#profile=no
16*9c5db199SXin Li
17*9c5db199SXin Li# Add <file or directory> to the deny list. It should be a base name, not a
18*9c5db199SXin Li# path. You may set this option multiple times.
19*9c5db199SXin Li#ignore=CVS
20*9c5db199SXin Li
21*9c5db199SXin Li# Pickle collected data for later comparisons.
22*9c5db199SXin Li#persistent=yes
23*9c5db199SXin Li
24*9c5db199SXin Li# List of plugins (as comma separated values of python modules names) to load,
25*9c5db199SXin Li# usually to register additional checkers.
26*9c5db199SXin Li#load-plugins=
27*9c5db199SXin Li
28*9c5db199SXin Li
29*9c5db199SXin Li[MESSAGES CONTROL]
30*9c5db199SXin Li
31*9c5db199SXin Li# Disable the message, report, category or checker with the given id(s). You
32*9c5db199SXin Li# can either give multiple identifier separated by comma (,) or put this option
33*9c5db199SXin Li# multiple times (only on the command line, not in the configuration file where
34*9c5db199SXin Li# it should appear only once).
35*9c5db199SXin Li# C0103: Invalid name ""
36*9c5db199SXin Li# C0111: Missing docstring
37*9c5db199SXin Li# C0302: Too many lines in module (N)
38*9c5db199SXin Li# C0321: More than one statement on a single line
39*9c5db199SXin Li# E1103: Instance has no '*' member (but some types could not be inferred)
40*9c5db199SXin Li# I0011: Locally disabling warning.
41*9c5db199SXin Li# R0201: Method could be a function
42*9c5db199SXin Li# R0902: Too many instance attributes (N/7)
43*9c5db199SXin Li# R0903: Too few public methods (N/2)
44*9c5db199SXin Li# R0911: Too many return statements (N/6)
45*9c5db199SXin Li# R0912: Too many branches (N/12)
46*9c5db199SXin Li# R0913: Too many arguments (N/5)
47*9c5db199SXin Li# R0914: Too many local variables (N/15)
48*9c5db199SXin Li# R0915: Too many statements (N/50)
49*9c5db199SXin Li# W0122: Use of the exec statement
50*9c5db199SXin Li# W0141: Used builtin function ''
51*9c5db199SXin Li# W0142: Used * or ** magic
52*9c5db199SXin Li# W0403: Relative import 'constants', should be 'chromite.cbuildbot.constants'
53*9c5db199SXin Li# W0511: Used when a warning note as FIXME or XXX is detected.
54*9c5db199SXin Li# W0703: Catching too general exception Exception.
55*9c5db199SXin Li# R0904: Too many public methods
56*9c5db199SXin Li# R0921: Abstract class not referenced.
57*9c5db199SXin Li# R0922: Abstract class is only referenced N times.
58*9c5db199SXin Li# CHANGE: actual disable string is in run_pylint since the rc file seems to
59*9c5db199SXin Li# have trouble with disabling everything then enabling just one check.
60*9c5db199SXin Li#disable=C0103,C0111,C0302,C0321,E1103,I0011,R0201,R0902,R0903,R0911,R0912,
61*9c5db199SXin Li#R0913,R0914,R0915,W0122,W0141,W0142,W0403,W0511,W0703,R0904,R0921,R0922
62*9c5db199SXin Li
63*9c5db199SXin Li# Enable the message, report, category or checker with the given id(s). You can
64*9c5db199SXin Li# either give multiple identifier separated by comma (,) or put this option
65*9c5db199SXin Li# multiple times.
66*9c5db199SXin Li#enable=W0611
67*9c5db199SXin Li
68*9c5db199SXin Li
69*9c5db199SXin Li[REPORTS]
70*9c5db199SXin Li
71*9c5db199SXin Li# Set the output format. Available formats are text, parseable, colorized, msvs
72*9c5db199SXin Li# (visual studio) and html
73*9c5db199SXin Li#output-format=text
74*9c5db199SXin Li
75*9c5db199SXin Li# Include message's id in output
76*9c5db199SXin Li# CHANGE: Include message ids in output.
77*9c5db199SXin Liinclude-ids=yes
78*9c5db199SXin Li
79*9c5db199SXin Li# Put messages in a separate file for each module / package specified on the
80*9c5db199SXin Li# command line instead of printing them on stdout. Reports (if any) will be
81*9c5db199SXin Li# written in a file name "pylint_global.[txt|html]".
82*9c5db199SXin Li#files-output=no
83*9c5db199SXin Li
84*9c5db199SXin Li# Tells whether to display a full report or only the messages
85*9c5db199SXin Li# CHANGE: No report.
86*9c5db199SXin Lireports=no
87*9c5db199SXin Li
88*9c5db199SXin Li# Python expression which should return a note less than 10 (10 is the highest
89*9c5db199SXin Li# note). You have access to the variables errors warning, statement which
90*9c5db199SXin Li# respectively contain the number of errors / warnings messages and the total
91*9c5db199SXin Li# number of statements analyzed. This is used by the global evaluation report
92*9c5db199SXin Li# (RP0004).
93*9c5db199SXin Li# all_failures = error + warning + refactor + convention
94*9c5db199SXin Li# evaluation = 10.0 - ((float(5 * all_failures) / statement) * 10)
95*9c5db199SXin Li
96*9c5db199SXin Li# Add a comment according to your evaluation note. This is used by the global
97*9c5db199SXin Li# evaluation report (RP0004).
98*9c5db199SXin Li#comment=no
99*9c5db199SXin Li
100*9c5db199SXin Li
101*9c5db199SXin Li[MISCELLANEOUS]
102*9c5db199SXin Li
103*9c5db199SXin Li# List of note tags to take in consideration, separated by a comma.
104*9c5db199SXin Li#notes=FIXME,XXX,TODO
105*9c5db199SXin Li
106*9c5db199SXin Li
107*9c5db199SXin Li[FORMAT]
108*9c5db199SXin Li
109*9c5db199SXin Li# Maximum number of characters on a single line.
110*9c5db199SXin Li#max-line-length=80
111*9c5db199SXin Li
112*9c5db199SXin Li# Maximum number of lines in a module
113*9c5db199SXin Li#max-module-lines=1000
114*9c5db199SXin Li
115*9c5db199SXin Li# String used as indentation unit. This is usually "    " (4 spaces) or "\t" (1
116*9c5db199SXin Li# tab).
117*9c5db199SXin Liindent-string="    "
118*9c5db199SXin Li
119*9c5db199SXin Li
120*9c5db199SXin Li[TYPECHECK]
121*9c5db199SXin Li
122*9c5db199SXin Li# Tells whether missing members accessed in mixin class should be ignored. A
123*9c5db199SXin Li# mixin class is detected if its name ends with "mixin" (case insensitive).
124*9c5db199SXin Li#ignore-mixin-members=yes
125*9c5db199SXin Li
126*9c5db199SXin Li# List of classes names for which member attributes should not be checked
127*9c5db199SXin Li# (useful for classes with attributes dynamically set).
128*9c5db199SXin Li#ignored-classes=SQLObject
129*9c5db199SXin Li
130*9c5db199SXin Li# When zope mode is activated, add a predefined set of Zope acquired attributes
131*9c5db199SXin Li# to generated-members.
132*9c5db199SXin Li#zope=no
133*9c5db199SXin Li
134*9c5db199SXin Li# List of members which are set dynamically and missed by pylint inference
135*9c5db199SXin Li# system, and so shouldn't trigger E0201 when accessed.
136*9c5db199SXin Li# CHANGE: Added 'AndRaise', 'AndReturn', 'InAnyOrder' and 'MultipleTimes'
137*9c5db199SXin Li#         for pymox.
138*9c5db199SXin Li# CHANGE: Added tempdir for @osutils.TempDirDecorator.
139*9c5db199SXin Ligenerated-members=REQUEST,acl_users,aq_parent,AndRaise,AndReturn,
140*9c5db199SXin Li                  InAnyOrder,MultipleTimes,tempdir
141*9c5db199SXin Li
142*9c5db199SXin Li
143*9c5db199SXin Li[BASIC]
144*9c5db199SXin Li
145*9c5db199SXin Li# Required attributes for module, separated by a comma
146*9c5db199SXin Li#required-attributes=
147*9c5db199SXin Li
148*9c5db199SXin Li# List of builtins function names that should not be used, separated by a comma
149*9c5db199SXin Li#bad-functions=map,filter,apply,input
150*9c5db199SXin Li
151*9c5db199SXin Li# Regular expression which should only match correct module names
152*9c5db199SXin Li#module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
153*9c5db199SXin Li
154*9c5db199SXin Li# Regular expression which should only match correct module level names
155*9c5db199SXin Li#const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
156*9c5db199SXin Li
157*9c5db199SXin Li# Regular expression which should only match correct class names
158*9c5db199SXin Li#class-rgx=[A-Z_][a-zA-Z0-9]+$
159*9c5db199SXin Li
160*9c5db199SXin Li# Regular expression which should only match correct function names
161*9c5db199SXin Li#
162*9c5db199SXin Li# CHANGE: The ChromiumOS standard is different than PEP-8, so we need to
163*9c5db199SXin Li# redefine this.
164*9c5db199SXin Li#
165*9c5db199SXin Li# Common exceptions to ChromiumOS standard:
166*9c5db199SXin Li# - main: Standard for main function
167*9c5db199SXin Lifunction-rgx=([A-Z_][a-zA-Z0-9]{2,30}|main)$
168*9c5db199SXin Li
169*9c5db199SXin Li# Regular expression which should only match correct method names
170*9c5db199SXin Li#
171*9c5db199SXin Li# CHANGE: The ChromiumOS standard is different than PEP-8, so we need to
172*9c5db199SXin Li# redefine this. Here's what we allow:
173*9c5db199SXin Li# - CamelCaps, starting with a capital letter.  No underscores in function
174*9c5db199SXin Li#   names.  Can also have a "_" prefix (private method) or a "test" prefix
175*9c5db199SXin Li#   (unit test).
176*9c5db199SXin Li# - Methods that look like __xyz__, which are used to do things like
177*9c5db199SXin Li#   __init__, __del__, etc.
178*9c5db199SXin Li# - setUp, tearDown: For unit tests.
179*9c5db199SXin Limethod-rgx=((_|test)?[A-Z][a-zA-Z0-9]{2,30}|__[a-z]+__|setUp|tearDown)$
180*9c5db199SXin Li
181*9c5db199SXin Li# Regular expression which should only match correct instance attribute names
182*9c5db199SXin Li#attr-rgx=[a-z_][a-z0-9_]{2,30}$
183*9c5db199SXin Li
184*9c5db199SXin Li# Regular expression which should only match correct argument names
185*9c5db199SXin Li#argument-rgx=[a-z_][a-z0-9_]{2,30}$
186*9c5db199SXin Li
187*9c5db199SXin Li# Regular expression which should only match correct variable names
188*9c5db199SXin Li#variable-rgx=[a-z_][a-z0-9_]{2,30}$
189*9c5db199SXin Li
190*9c5db199SXin Li# Regular expression which should only match correct list comprehension /
191*9c5db199SXin Li# generator expression variable names
192*9c5db199SXin Li#inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
193*9c5db199SXin Li
194*9c5db199SXin Li# Good variable names which should always be accepted, separated by a comma
195*9c5db199SXin Li#good-names=i,j,k,ex,Run,_
196*9c5db199SXin Li
197*9c5db199SXin Li# Bad variable names which should always be refused, separated by a comma
198*9c5db199SXin Li#bad-names=foo,bar,baz,toto,tutu,tata
199*9c5db199SXin Li
200*9c5db199SXin Li# Regular expression which should only match functions or classes name which do
201*9c5db199SXin Li# not require a docstring
202*9c5db199SXin Li#no-docstring-rgx=__.*__
203*9c5db199SXin Li
204*9c5db199SXin Li
205*9c5db199SXin Li[SIMILARITIES]
206*9c5db199SXin Li
207*9c5db199SXin Li# Minimum lines number of a similarity.
208*9c5db199SXin Limin-similarity-lines=8
209*9c5db199SXin Li
210*9c5db199SXin Li# Ignore comments when computing similarities.
211*9c5db199SXin Li#ignore-comments=yes
212*9c5db199SXin Li
213*9c5db199SXin Li# Ignore docstrings when computing similarities.
214*9c5db199SXin Li#ignore-docstrings=yes
215*9c5db199SXin Li
216*9c5db199SXin Li
217*9c5db199SXin Li[VARIABLES]
218*9c5db199SXin Li
219*9c5db199SXin Li# Tells whether we should check for unused import in __init__ files.
220*9c5db199SXin Li#init-import=no
221*9c5db199SXin Li
222*9c5db199SXin Li# A regular expression matching the beginning of the name of dummy variables
223*9c5db199SXin Li# (i.e. not used).
224*9c5db199SXin Li#dummy-variables-rgx=_|dummy
225*9c5db199SXin Li
226*9c5db199SXin Li# List of additional names supposed to be defined in builtins. Remember that
227*9c5db199SXin Li# you should avoid to define new builtins when possible.
228*9c5db199SXin Li#additional-builtins=
229*9c5db199SXin Li
230*9c5db199SXin Li
231*9c5db199SXin Li[CLASSES]
232*9c5db199SXin Li
233*9c5db199SXin Li# List of interface methods to ignore, separated by a comma. This is used for
234*9c5db199SXin Li# instance to not check methods defines in Zope's Interface base class.
235*9c5db199SXin Li#ignore-iface-methods=isImplementedBy,deferred,extends,names,
236*9c5db199SXin Li#namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,
237*9c5db199SXin Li#getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,
238*9c5db199SXin Li#isImplementedByInstancesOf,adaptWith,is_implemented_by
239*9c5db199SXin Li
240*9c5db199SXin Li# List of method names used to declare (i.e. assign) instance attributes.
241*9c5db199SXin Li#defining-attr-methods=__init__,__new__,setUp
242*9c5db199SXin Li
243*9c5db199SXin Li
244*9c5db199SXin Li[DESIGN]
245*9c5db199SXin Li
246*9c5db199SXin Li# Maximum number of arguments for function / method
247*9c5db199SXin Li#max-args=5
248*9c5db199SXin Li
249*9c5db199SXin Li# Argument names that match this expression will be ignored. Default to name
250*9c5db199SXin Li# with leading underscore
251*9c5db199SXin Li#ignored-argument-names=_.*
252*9c5db199SXin Li
253*9c5db199SXin Li# Maximum number of locals for function / method body
254*9c5db199SXin Li#max-locals=15
255*9c5db199SXin Li
256*9c5db199SXin Li# Maximum number of return / yield for function / method body
257*9c5db199SXin Li#max-returns=6
258*9c5db199SXin Li
259*9c5db199SXin Li# Maximum number of branch for function / method body
260*9c5db199SXin Li#max-branchs=12
261*9c5db199SXin Li
262*9c5db199SXin Li# Maximum number of statements in function / method body
263*9c5db199SXin Li#max-statements=50
264*9c5db199SXin Li
265*9c5db199SXin Li# Maximum number of parents for a class (see R0901).
266*9c5db199SXin Limax-parents=10
267*9c5db199SXin Li
268*9c5db199SXin Li# Maximum number of attributes for a class (see R0902).
269*9c5db199SXin Li#max-attributes=7
270*9c5db199SXin Li
271*9c5db199SXin Li# Minimum number of public methods for a class (see R0903).
272*9c5db199SXin Li#min-public-methods=2
273*9c5db199SXin Li
274*9c5db199SXin Li# Maximum number of public methods for a class (see R0904).
275*9c5db199SXin Li#max-public-methods=20
276*9c5db199SXin Li
277*9c5db199SXin Li
278*9c5db199SXin Li[IMPORTS]
279*9c5db199SXin Li
280*9c5db199SXin Li# Deprecated modules which should not be used, separated by a comma
281*9c5db199SXin Li#deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
282*9c5db199SXin Li
283*9c5db199SXin Li# Create a graph of every (i.e. internal and external) dependencies in the
284*9c5db199SXin Li# given file (report RP0402 must not be disabled)
285*9c5db199SXin Li#import-graph=
286*9c5db199SXin Li
287*9c5db199SXin Li# Create a graph of external dependencies in the given file (report RP0402 must
288*9c5db199SXin Li# not be disabled)
289*9c5db199SXin Li#ext-import-graph=
290*9c5db199SXin Li
291*9c5db199SXin Li# Create a graph of internal dependencies in the given file (report RP0402 must
292*9c5db199SXin Li# not be disabled)
293*9c5db199SXin Li#int-import-graph=
294