1pylint(1) General Commands Manual pylint(1)
2
3
4
6 pylint - python code static checker
7
8
10 pylint [ OPTIONS ] [ <arguments> ]
11
12
14 pylint is a Python source code analyzer which looks for programming
15 errors, helps enforcing a coding standard and sniffs for some code
16 smells (as defined in Martin Fowler's Refactoring book)
17
18 Pylint can be seen as another PyChecker since nearly all tests you can
19 do with PyChecker can also be done with Pylint. However, Pylint offers
20 some more features, like checking length of lines of code, checking if
21 variable names are well-formed according to your coding standard, or
22 checking if declared interfaces are truly implemented, and much more.
23
24 Additionally, it is possible to write plugins to add your own checks.
25
26
28 --version
29 show program's version number and exit
30
31 --help, -h
32 show this help message and exit
33
34
36 --rcfile=<file>
37 Specify a configuration file.
38
39 --init-hook=<code>
40 Python code to execute, usually for sys.path manipulation such
41 as pygtk.require().
42
43 --rpython-mode
44 enable the rpython checker which is disabled by default
45
46 --errors-only, -e
47 In debug mode, checkers without error messages are disabled and
48 for others, only the ERROR messages are displayed, and no
49 reports are done by default
50
51 --profile=<y_or_n>
52 Profiled execution. [current: %default]
53
54 --ignore=<file>
55 Add <file or directory> to the black list. It should be a base
56 name, not a path. You may set this option multiple times. [cur‐
57 rent: %default]
58
59 --persistent=<y_or_n>
60 Pickle collected data for later comparisons. [current: %default]
61
62 --cache-size=<size>
63 Set the cache size for astng objects. [current: %default]
64
65 --load-plugins=<modules>
66 List of plugins (as comma separated values of python modules
67 names) to load, usually to register additional checkers. [cur‐
68 rent: %default]
69
70
72 --help-msg=<msg-id>
73 Display a help message for the given message id and exit. The
74 value may be a comma separated list of message ids.
75
76 --list-msgs
77 Generate pylint's full documentation.
78
79 --generate-rcfile
80 Generate a sample configuration file according to the current
81 configuration. You can put other options before this one to get
82 them in the generated configuration.
83
84 --generate-man
85 Generate pylint's man page.
86
87
89 --enable-checker=<checker ids>
90 Enable only checker(s) with the given id(s).
91 This option conflicts with the disable-checker option
92
93 --disable-checker=<checker ids>
94 Enable all checker(s) except those with the
95 given id(s). This option conflicts with the
96 enable-checker option
97
98 --enable-msg-cat=<msg cats>
99 Enable all messages in the listed categories.
100
101 --disable-msg-cat=<msg cats>
102 Disable all messages in the listed categories.
103
104 --enable-msg=<msg ids>
105 Enable the message(s) with the given id(s).
106
107 --disable-msg=<msg ids>
108 Disable the message(s) with the given id(s).
109
110
112 --output-format=<format>, -f <format>
113 set the output format. Available formats are text,
114 parseable, colorized, msvs (visual studio) and html [current:
115 %default]
116
117 --include-ids=<y_or_n>, -i <y_or_n>
118 Include message's id in output [current: %default]
119
120 --files-output=<y_or_n>
121 Put messages in a separate file for each module / package speci‐
122 fied on the command line instead of printing them on stdout.
123 Reports (if any) will be written in a file name
124 "pylint_global.[txt|html]". [current: %default]
125
126 --reports=<y_or_n>, -r <y_or_n>
127 Tells wether to display a full report or only the messages [cur‐
128 rent: %default]
129
130 --evaluation=<python_expression>
131 Python expression which should return a note less than 10 (10 is
132 the highest note).You have access to the variables errors warn‐
133 ing, statement which respectivly contain the number of errors /
134 warnings messages and the total number of statements analyzed.
135 This is used by the global evaluation report (R0004). [current:
136 %default]
137
138 --comment=<y_or_n>
139 Add a comment according to your evaluation note. This is used by
140 the global evaluation report (R0004). [current: %default]
141
142 --enable-report=<rpt ids>
143 Enable the report(s) with the given id(s).
144
145 --disable-report=<rpt ids>
146 Disable the report(s) with the given id(s).
147
148
150 --required-attributes=<attributes>
151 Required attributes for module, separated by a comma [current:
152 %default]
153
154 --no-docstring-rgx=<regexp>
155 Regular expression which should only match functions or classes
156 name which do not require a docstring [current: %default]
157
158 --module-rgx=<regexp>
159 Regular expression which should only match correct module names
160 [current: %default]
161
162 --const-rgx=<regexp>
163 Regular expression which should only match correct module level
164 names [current: %default]
165
166 --class-rgx=<regexp>
167 Regular expression which should only match correct class names
168 [current: %default]
169
170 --function-rgx=<regexp>
171 Regular expression which should only match correct function
172 names [current: %default]
173
174 --method-rgx=<regexp>
175 Regular expression which should only match correct method names
176 [current: %default]
177
178 --attr-rgx=<regexp>
179 Regular expression which should only match correct instance
180 attribute names [current: %default]
181
182 --argument-rgx=<regexp>
183 Regular expression which should only match correct argument
184 names [current: %default]
185
186 --variable-rgx=<regexp>
187 Regular expression which should only match correct variable
188 names [current: %default]
189
190 --inlinevar-rgx=<regexp>
191 Regular expression which should only match correct list compre‐
192 hension / generator expression variable
193 names [current: %default]
194
195 --good-names=<names>
196 Good variable names which should always be accepted, separated
197 by a comma [current: %default]
198
199 --bad-names=<names>
200 Bad variable names which should always be refused, separated by
201 a comma [current: %default]
202
203 --bad-functions=<builtin function names>
204 List of builtins function names that should not be used, sepa‐
205 rated by a comma [current: %default]
206
207
209 --ignore-iface-methods=<method names>
210 List of interface methods to ignore, separated by a comma. This
211 is used for instance to not check methods defines in Zope's
212 Interface base class. [current: %default]
213
214 --defining-attr-methods=<method names>
215 List of method names used to declare (i.e. assign) instance
216 attributes. [current: %default]
217
218
220 --max-args=<int>
221 Maximum number of arguments for function / method [current:
222 %default]
223
224 --max-locals=<int>
225 Maximum number of locals for function / method body [current:
226 %default]
227
228 --max-returns=<int>
229 Maximum number of return / yield for function / method body
230 [current: %default]
231
232 --max-branchs=<int>
233 Maximum number of branch for function / method body [current:
234 %default]
235
236 --max-statements=<int>
237 Maximum number of statements in function / method body [current:
238 %default]
239
240 --max-parents=<num>
241 Maximum number of parents for a class (see R0901). [current:
242 %default]
243
244 --max-attributes=<num>
245 Maximum number of attributes for a class (see R0902). [current:
246 %default]
247
248 --min-public-methods=<num>
249 Minimum number of public methods for a class (see R0903). [cur‐
250 rent: %default]
251
252 --max-public-methods=<num>
253 Maximum number of public methods for a class (see R0904). [cur‐
254 rent: %default]
255
256
258 --max-line-length=<int>
259 Maximum number of characters on a single line. [current:
260 %default]
261
262 --max-module-lines=<int>
263 Maximum number of lines in a module [current: %default]
264
265 --indent-string=<string>
266 String used as indentation unit. This is usually " " (4 spa‐
267 ces) or "" (1 tab). [current: %default]
268
269
271 --deprecated-modules=<modules>
272 Deprecated modules which should not be used, separated by a
273 comma [current: %default]
274
275 --import-graph=<file.dot>
276 Create a graph of every (i.e. internal and external) dependen‐
277 cies in the given file (report R0402 must not be disabled) [cur‐
278 rent: %default]
279
280 --ext-import-graph=<file.dot>
281 Create a graph of external dependencies in the given file
282 (report R0402 must not be disabled) [current: %default]
283
284 --int-import-graph=<file.dot>
285 Create a graph of internal dependencies in the given file
286 (report R0402 must not be disabled) [current: %default]
287
288
290 --notes=<comma separated values>
291 List of note tags to take in consideration, separated by a
292 comma. [current: %default]
293
294
296 --min-similarity-lines=<int>
297 Minimum lines number of a similarity. [current: %default]
298
299 --ignore-comments=<y or n>
300 Ignore comments when computing similarities. [current: %default]
301
302 --ignore-docstrings=<y or n>
303 Ignore docstrings when computing similarities. [current:
304 %default]
305
306
308 --ignore-mixin-members=<y_or_n>
309 Tells wether missing members accessed in mixin class should be
310 ignored. A mixin class is detected if its name ends with "mixin"
311 (case insensitive). [current: %default]
312
313 --zope=<y_or_n>
314 When zope mode is activated, consider the acquired-members
315 option to ignore access to some undefined attributes. [current:
316 %default]
317
318 --acquired-members=<members names>
319 List of members which are usually get through zope's acquisition
320 mecanism and so shouldn't trigger E0201 when accessed (need
321 zope=yes to be considered). [current: %default]
322
323
325 --init-import=<y_or_n>
326 Tells wether we should check for unused import in __init__
327 files. [current: %default]
328
329 --dummy-variables-rgx=<regexp>
330 A regular expression matching names used for
331 dummy variables (i.e. not used). [current: %default]
332
333 --additional-builtins=<comma separated list>
334 List of additional names supposed to be defined in builtins.
335 Remember that you should avoid to define new builtins when pos‐
336 sible. [current: %default]
337
338
340 The following environment variables are used :
341 * PYLINTHOME
342 path to the directory where data of persistent run will be stored.
343 If not found, it defaults to ~/.pylint.d/ or .pylint.d (in the current
344 working directory) . The current PYLINTHOME is /home/syt/.pylint.d.
345 * PYLINTRC
346 path to the configuration file. If not found, it will use the first
347 existant file in ~/.pylintrc, /etc/pylintrc. The current PYLINTRC is
348 None.
349
350
352 Using the default text output, the message format is :
353 MESSAGE_TYPE: LINE_NUM:[OBJECT:] MESSAGE There are 5 kind of
354 message types :
355 * (C) convention, for programming standard violation
356 * (R) refactor, for bad code smell
357 * (W) warning, for python specific problems
358 * (E) error, for much probably bugs in the code
359 * (F) fatal, if an error occured which prevented pylint from doing
360 further processing.
361
362
364 /usr/share/doc/pythonX.Y-pylint/
365
366
368 Copyright (c) 2003-2007 Sylvain Thenault (thenault@gmail.com). Copy‐
369 right (c) 2003-2007 LOGILAB S.A. (Paris, FRANCE). http://www.logi‐
370 lab.fr/ -- mailto:contact@logilab.fr
371
372 This program is free software; you can redistribute it and/or modify it
373 under the terms of the GNU General Public License as published by the
374 Free Software Foundation; either version 2 of the License, or (at your
375 option) any later version.
376
377 This program is distributed in the hope that it will be useful, but
378 WITHOUT ANY WARRANTY; without even the implied warranty of MER‐
379 CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
380 Public License for more details.
381
382 You should have received a copy of the GNU General Public License along
383 with this program; if not, write to the Free Software Foundation, Inc.,
384 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
385
387 Please report bugs on the project's mailing list: mailto://python-
388 projects@logilab.org
389
390
392 Sylvain Thenault <sylvain.thenault@logilab.fr>
393
394
395
396
397pylint 2007-6-7 pylint(1)