1pylint(1)                   General Commands Manual                  pylint(1)
2
3
4

NAME

6       pylint - python code static checker
7
8

SYNOPSIS

10       pylint [ OPTIONS ] [ <arguments> ]
11
12

DESCRIPTION

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
27

OPTIONS

29       --version
30              show program's version number and exit
31
32       --help, -h
33              show this help message and exit
34
35       --long-help
36              more verbose help.
37
38

MASTER

40       --rcfile=<file>
41              Specify a configuration file.
42
43       --init-hook=<code>
44              Python  code  to execute, usually for sys.path manipulation such
45              as pygtk.require().
46
47       --errors-only, -E
48              In error mode, checkers without error messages are disabled  and
49              for  others,  only  the  ERROR  messages  are  displayed, and no
50              reports are done by default
51
52       --ignore=<file>
53              Add <file or directory> to the black list. It should be  a  base
54              name,  not a path. You may set this option multiple times. [cur‐
55              rent: CVS]
56
57       --persistent=<y_or_n>
58              Pickle collected data for later comparisons. [current: yes]
59
60       --load-plugins=<modules>
61              List of plugins (as comma separated  values  of  python  modules
62              names)  to  load, usually to register additional checkers. [cur‐
63              rent: none]
64
65

COMMANDS

67       --help-msg=<msg-id>
68              Display a help message for the given message id  and  exit.  The
69              value may be a comma separated list of message ids.
70
71       --list-msgs
72              Generate pylint's messages.
73
74       --full-documentation
75              Generate pylint's full documentation.
76
77       --generate-rcfile
78              Generate  a  sample  configuration file according to the current
79              configuration. You can put other options before this one to  get
80              them in the generated configuration.
81
82

MESSAGES CONTROL

84       --enable=<msg ids>, -e <msg ids>
85              Enable  the  message, report, category or checker with the given
86              id(s). You can either  give  multiple  identifier  separated  by
87              comma (,) or put this option multiple time.
88
89       --disable=<msg ids>, -d <msg ids>
90              Disable  the message, report, category or checker with the given
91              id(s). You can either  give  multiple  identifier  separated  by
92              comma  (,) or put this option multiple time (only on the command
93              line, not in the configuration file where it should appear  only
94              once).
95
96

REPORTS

98       --output-format=<format>, -f <format>
99              Set   the   output   format.   Available   formats   are   text,
100              parseable, colorized, msvs (visual studio)  and  html  [current:
101              text]
102
103       --include-ids=<y_or_n>, -i <y_or_n>
104              Include message's id in output [current: no]
105
106       --files-output=<y_or_n>
107              Put messages in a separate file for each module / package speci‐
108              fied on the command line instead of  printing  them  on  stdout.
109              Reports   (if   any)   will   be   written   in   a   file  name
110              "pylint_global.[txt|html]". [current: no]
111
112       --reports=<y_or_n>, -r <y_or_n>
113              Tells whether to display a full  report  or  only  the  messages
114              [current: yes]
115
116       --evaluation=<python_expression>
117              Python expression which should return a note less than 10 (10 is
118              the highest note). You have access to the variables errors warn‐
119              ing, statement which respectively contain the number of errors /
120              warnings messages and the total number of  statements  analyzed.
121              This  is  used  by the  global evaluation report (RP0004). [cur‐
122              rent: 10.0 - ((float(5 * error + warning +  refactor  +  conven‐
123              tion) / statement) * 10)]
124
125       --comment=<y_or_n>
126              Add a comment according to your evaluation note. This is used by
127              the global evaluation report (RP0004). [current: no]
128
129

FORMAT

131       --max-line-length=<int>
132              Maximum number of characters on a single line. [current: 80]
133
134       --max-module-lines=<int>
135              Maximum number of lines in a module [current: 1000]
136
137       --indent-string=<string>
138              String used as indentation unit. This is usually "    " (4  spa‐
139              ces) or "" (1 tab). [current: '    ']
140
141

IMPORTS

143       --deprecated-modules=<modules>
144              Deprecated  modules  which  should  not  be used, separated by a
145              comma [current: regsub,string,TERMIOS,Bastion,rexec]
146
147       --import-graph=<file.dot>
148              Create a graph of every (i.e. internal and  external)  dependen‐
149              cies  in  the  given  file  (report RP0402 must not be disabled)
150              [current: none]
151
152       --ext-import-graph=<file.dot>
153              Create a graph  of  external  dependencies  in  the  given  file
154              (report RP0402 must not be disabled) [current: none]
155
156       --int-import-graph=<file.dot>
157              Create  a  graph  of  internal  dependencies  in  the given file
158              (report RP0402 must not be disabled) [current: none]
159
160

DESIGN

162       --max-args=<int>
163              Maximum number of arguments for function / method [current: 5]
164
165       --ignored-argument-names=<regexp>
166              Argument names that  match  this  expression  will  be  ignored.
167              Default to name with leading underscore [current: _.*]
168
169       --max-locals=<int>
170              Maximum  number  of  locals for function / method body [current:
171              15]
172
173       --max-returns=<int>
174              Maximum number of return / yield  for  function  /  method  body
175              [current: 6]
176
177       --max-branchs=<int>
178              Maximum  number  of  branch for function / method body [current:
179              12]
180
181       --max-statements=<int>
182              Maximum number of statements in function / method body [current:
183              50]
184
185       --max-parents=<num>
186              Maximum number of parents for a class (see R0901). [current: 7]
187
188       --max-attributes=<num>
189              Maximum  number of attributes for a class (see R0902). [current:
190              7]
191
192       --min-public-methods=<num>
193              Minimum number of public methods for a class (see R0903).  [cur‐
194              rent: 2]
195
196       --max-public-methods=<num>
197              Maximum  number of public methods for a class (see R0904). [cur‐
198              rent: 20]
199
200

MISCELLANEOUS

202       --notes=<comma separated values>
203              List of note tags to  take  in  consideration,  separated  by  a
204              comma. [current: FIXME,XXX,TODO]
205
206

VARIABLES

208       --init-import=<y_or_n>
209              Tells  whether  we  should  check  for unused import in __init__
210              files. [current: no]
211
212       --dummy-variables-rgx=<regexp>
213              A    regular    expression    matching    the    beginning    of
214              the name of dummy variables (i.e. not used). [current: _|dummy]
215
216       --additional-builtins=<comma separated list>
217              List  of  additional  names  supposed to be defined in builtins.
218              Remember that you should avoid to define new builtins when  pos‐
219              sible. [current: none]
220
221

TYPECHECK

223       --ignore-mixin-members=<y_or_n>
224              Tells  whether missing members accessed in mixin class should be
225              ignored. A mixin class is detected if its name ends with "mixin"
226              (case insensitive). [current: yes]
227
228       --ignored-classes=<members names>
229              List  of classes names for which member attributes should not be
230              checked (useful for classes with  attributes  dynamically  set).
231              [current: SQLObject]
232
233       --zope=<y_or_n>
234              When  zope  mode  is  activated,  add  a  predefined set of Zope
235              acquired attributes to generated-members. [current: no]
236
237       --generated-members=<members names>
238              List of members which are set dynamically and missed  by  pylint
239              inference  system, and so shouldn't trigger E0201 when accessed.
240              [current: REQUEST,acl_users,aq_parent]
241
242

BASIC

244       --required-attributes=<attributes>
245              Required attributes for module, separated by a  comma  [current:
246              none]
247
248       --bad-functions=<builtin function names>
249              List  of  builtins function names that should not be used, sepa‐
250              rated by a comma [current: map,filter,apply,input]
251
252       --module-rgx=<regexp>
253              Regular expression which should only match correct module  names
254              [current: (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$]
255
256       --const-rgx=<regexp>
257              Regular  expression which should only match correct module level
258              names [current: (([A-Z_][A-Z0-9_]*)|(__.*__))$]
259
260       --class-rgx=<regexp>
261              Regular expression which should only match correct  class  names
262              [current: [A-Z_][a-zA-Z0-9]+$]
263
264       --function-rgx=<regexp>
265              Regular  expression  which  should  only  match correct function
266              names [current: [a-z_][a-z0-9_]{2,30}$]
267
268       --method-rgx=<regexp>
269              Regular expression which should only match correct method  names
270              [current: [a-z_][a-z0-9_]{2,30}$]
271
272       --attr-rgx=<regexp>
273              Regular  expression  which  should  only  match correct instance
274              attribute names [current: [a-z_][a-z0-9_]{2,30}$]
275
276       --argument-rgx=<regexp>
277              Regular expression which  should  only  match  correct  argument
278              names [current: [a-z_][a-z0-9_]{2,30}$]
279
280       --variable-rgx=<regexp>
281              Regular  expression  which  should  only  match correct variable
282              names [current: [a-z_][a-z0-9_]{2,30}$]
283
284       --inlinevar-rgx=<regexp>
285              Regular expression which should only match correct list  compre‐
286              hension        /       generator       expression       variable
287              names [current: [A-Za-z_][A-Za-z0-9_]*$]
288
289       --good-names=<names>
290              Good variable names which should always be  accepted,  separated
291              by a comma [current: i,j,k,ex,Run,_]
292
293       --bad-names=<names>
294              Bad  variable names which should always be refused, separated by
295              a comma [current: foo,bar,baz,toto,tutu,tata]
296
297       --no-docstring-rgx=<regexp>
298              Regular expression which should only match functions or  classes
299              name which do not require a docstring [current: __.*__]
300
301

SIMILARITIES

303       --min-similarity-lines=<int>
304              Minimum lines number of a similarity. [current: 4]
305
306       --ignore-comments=<y or n>
307              Ignore comments when computing similarities. [current: yes]
308
309       --ignore-docstrings=<y or n>
310              Ignore docstrings when computing similarities. [current: yes]
311
312

CLASSES

314       --ignore-iface-methods=<method names>
315              List  of interface methods to ignore, separated by a comma. This
316              is used for instance to not  check  methods  defines  in  Zope's
317              Interface      base      class.      [current:      isImplement‐
318              edBy,deferred,extends,names,namesAndDescriptions,queryDescrip‐
319              tionFor,getBases,getDescriptionFor,getDoc,getName,getTagged‐
320              Value,getTaggedValueTags,isEqualOrExtendedBy,setTagged‐
321              Value,isImplementedByInstancesOf,adaptWith,is_implemented_by]
322
323       --defining-attr-methods=<method names>
324              List  of  method  names  used  to declare (i.e. assign) instance
325              attributes. [current: __init__,__new__,setUp]
326
327

ENVIRONMENT VARIABLES

329       The following environment variables are used :
330           * PYLINTHOME
331           path to the directory where data of persistent run will be  stored.
332       If  not found, it defaults to ~/.pylint.d/ or .pylint.d (in the current
333       working directory).
334           * PYLINTRC
335           path to the configuration file. If not found, it will use the first
336       existent file in ~/.pylintrc, /etc/pylintrc.
337
338

OUTPUT

340       Using the default text output, the message format is :
341
342               MESSAGE_TYPE: LINE_NUM:[OBJECT:] MESSAGE
343
344       There are 5 kind of message types :
345           * (C) convention, for programming standard violation
346           * (R) refactor, for bad code smell
347           * (W) warning, for python specific problems
348           * (E) error, for probable bugs in the code
349           * (F) fatal, if an error occurred which prevented pylint from doing
350       further processing.
351
352

OUTPUT STATUS CODE

354       Pylint should leave with following status code:
355           * 0 if everything went fine
356           * 1 if a fatal message was issued
357           * 2 if an error message was issued
358           * 4 if a warning message was issued
359           * 8 if a refactor message was issued
360           * 16 if a convention message was issued
361           * 32 on usage error
362
363       status 1 to 16 will be bit-ORed so you can know which  different  cate‐
364       gories has been issued by analysing pylint output status code
365
366

SEE ALSO

368       /usr/share/doc/pythonX.Y-pylint/
369
370
372       Logilab S.A.
373
374

BUGS

376       Please  report  bugs  on  the  project's mailing list: mailto://python-
377       projects@lists.logilab.org
378
379

AUTHOR

381       Logilab <python-projects@lists.logilab.org>
382
383
384
385
386pylint                            2010-11-15                         pylint(1)
Impressum