summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2010-10-25 16:15:36 +0200
committerEmile Anclin <emile.anclin@logilab.fr>2010-10-25 16:15:36 +0200
commit2554a84f4948a426abfcee3e443a5c37f49c18af (patch)
tree5c04a58238a02d1843ca836c6229d9d69380b3f3
parenta004b900ea8a67ef4fabcc68a4c31aa35f4807ad (diff)
downloadpylint-git-2554a84f4948a426abfcee3e443a5c37f49c18af.tar.gz
doc : more update on options
-rw-r--r--doc/features.txt854
-rw-r--r--doc/makefile4
-rw-r--r--doc/manual.txt48
-rw-r--r--examples/pylintrc4
-rw-r--r--lint.py4
-rw-r--r--man/pylint.14
6 files changed, 442 insertions, 476 deletions
diff --git a/doc/features.txt b/doc/features.txt
index 2d0531a8c..00374386f 100644
--- a/doc/features.txt
+++ b/doc/features.txt
@@ -9,30 +9,28 @@ General options
~~~~~~~~~~~~~~~
:rcfile:
Specify a configuration file.
-
:init-hook:
Python code to execute, usually for sys.path manipulation such as
pygtk.require().
-
:errors-only:
- In debug mode, checkers without error messages are disabled and for others,
+ In error mode, checkers without error messages are disabled and for others,
only the ERROR messages are displayed, and no reports are done by default
-
:profile:
Profiled execution.
-
:ignore:
Add <file or directory> to the black list. It should be a base name, not a
path. You may set this option multiple times.
- Default: ``CVS``
+ Default: ``CVS``
:persistent:
Pickle collected data for later comparisons.
- Default: ``yes``
+ Default: ``yes``
:load-plugins:
List of plugins (as comma separated values of python modules names) to load,
usually to register additional checkers.
+:long-help:
+ more verbose help.
Commands options
~~~~~~~~~~~~~~~~
@@ -40,6 +38,8 @@ Commands options
Display a help message for the given message id and exit. The value may be a
comma separated list of message ids.
:list-msgs:
+ Generate pylint's messages.
+:full-documentation:
Generate pylint's full documentation.
:generate-rcfile:
Generate a sample configuration file according to the current configuration.
@@ -50,20 +50,15 @@ Commands options
Messages control options
~~~~~~~~~~~~~~~~~~~~~~~~
-:enable-checker:
- Enable only checker(s) with the given id(s). This option conflicts with the
- disable-checker option
-:disable-checker:
- Enable all checker(s) except those with the given id(s). This option
- conflicts with the enable-checker option
-:enable-msg-cat:
- Enable all messages in the listed categories.
-:disable-msg-cat:
- Disable all messages in the listed categories.
-:enable-msg:
- Enable the message(s) with the given id(s).
-:disable-msg:
- Disable the message(s) with the given id(s).
+:enable:
+ Enable the message, report, category or checker with the given id(s). You can
+ either give multiple identifier separated by comma (,) or put this option
+ multiple time.
+:disable:
+ Disable the message, report, category or checker with the given id(s). You
+ can either give multiple identifier separated by comma (,) or put this option
+ multiple time (only on the command line, not in the configuration file where
+ it should appear only once).
Reports options
~~~~~~~~~~~~~~~
@@ -87,302 +82,144 @@ Reports options
note). You have access to the variables errors warning, statement which
respectively contain the number of errors / warnings messages and the total
number of statements analyzed. This is used by the global evaluation report
- (R0004).
+ (RP0004).
Default: ``10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)``
:comment:
Add a comment according to your evaluation note. This is used by the global
- evaluation report (R0004).
-:enable-report:
- Enable the report(s) with the given id(s).
-:disable-report:
- Disable the report(s) with the given id(s).
-
-Main messages
-~~~~~~~~~~~~~
-:E0001:
- Used when a syntax error is raised for a module.
-:E0011: *Unrecognized file option %r*
- Used when an unknown inline option is encountered.
-:E0012: *Bad option value %r*
- Used when a bad value for an inline option is encountered.
-:I0001: *Unable to run raw checkers on built-in module %s*
- Used to inform that a built-in module has not been checked using the raw
- checkers.
-:I0010: *Unable to consider inline option %r*
- Used when an inline option is either badly formatted or can't be used inside
- modules.
-:I0011: *Locally disabling %s*
- Used when an inline option disables a message or a messages category.
-:I0012: *Locally enabling %s*
- Used when an inline option enables a message or a messages category.
-:I0013: *Ignoring entire file*
- Used to inform that the file will not be checked
-:F0001:
- Used when an error occurred preventing the analysis of a module (unable to find
- it for instance).
-:F0002: *%s: %s*
- Used when an unexpected error occurred while building the ASTNG representation.
- This is usually accompanied by a traceback. Please report such errors !
-:F0003: *ignored builtin module %s*
- Used to indicate that the user asked to analyze a builtin module which has
- been skipped.
-:F0004: *unexpected inferred value %s*
- Used to indicate that some value of an unexpected type has been inferred.
-
-Main reports
-~~~~~~~~~~~~
-:R0001: Messages by category
-:R0002: % errors / warnings by module
-:R0003: Messages
-:R0004: Global evaluation
-
-
-Variables checker
------------------
-checks for
-* unused variables / imports
-* undefined variables
-* redefinition of variable from builtins or from an outer scope
-* use of variable before assignment
-
-Options
-~~~~~~~
-:init-import:
- Tells whether we should check for unused import in __init__ files.
-:dummy-variables-rgx:
- A regular expression matching names used for dummy variables (i.e. not used).
-
- Default: ``_|dummy``
-:additional-builtins:
- List of additional names supposed to be defined in builtins. Remember that
- you should avoid to define new builtins when possible.
+ evaluation report (RP0004).
+logging checker
+---------------
Messages
~~~~~~~~
-:E0601: *Using variable %r before assignment*
- Used when a local variable is accessed before it's assignment.
-:E0602: *Undefined variable %r*
- Used when an undefined variable is accessed.
-:E0611: *No name %r in module %r*
- Used when a name cannot be found in a module.
-:W0601: *Global variable %r undefined at the module level*
- Used when a variable is defined through the "global" statement but the
- variable is not defined in the module scope.
-:W0602: *Using global for %r but no assignment is done*
- Used when a variable is defined through the "global" statement but no
- assignment to this variable is done.
-:W0603: *Using the global statement*
- Used when you use the "global" statement to update a global variable. PyLint
- just try to discourage this usage. That doesn't mean you can not use it !
-:W0604: *Using the global statement at the module level*
- Used when you use the "global" statement at the module level since it has no
- effect
-:W0611: *Unused import %s*
- Used when an imported module or variable is not used.
-:W0612: *Unused variable %r*
- Used when a variable is defined but not used.
-:W0613: *Unused argument %r*
- Used when a function or method argument is not used.
-:W0614: *Unused import %s from wildcard import*
- Used when an imported module or variable is not used from a 'from X import *'
- style import.
-:W0621: *Redefining name %r from outer scope (line %s)*
- Used when a variable's name hide a name defined in the outer scope.
-:W0622: *Redefining built-in %r*
- Used when a variable or function override a built-in.
-:W0631: *Using possibly undefined loop variable %r*
- Used when an loop variable (i.e. defined by a for loop or a list comprehension
- or a generator expression) is used outside the loop.
+:W6501: *Specify string format arguments as logging function parameters*
+ Used when a logging statement has a call form of "logging.<logging
+ method>(format_string % (format_args...))". Such calls should leave string
+ interpolation to the logging method itself and be written "logging.<logging
+ method>(format_string, format_args...)" so that the program may avoid
+ incurring the cost of the interpolation in those cases in which no message
+ will be logged. For more, see http://www.python.org/dev/peps/pep-0282/.
-Basic checker
--------------
-checks for :
-* doc strings
-* modules / classes / functions / methods / arguments / variables name
-* number of arguments, local variables, branches, returns and statements in
-functions, methods
-* required module attributes
-* dangerous default values as arguments
-* redefinition of function / method / class
-* uses of the global statement
-
+similarities checker
+--------------------
Options
~~~~~~~
-:required-attributes:
- Required attributes for module, separated by a comma
-:no-docstring-rgx:
- Regular expression which should only match functions or classes name which do
- not require a docstring
-
- Default: ``__.*__``
-:module-rgx:
- Regular expression which should only match correct module names
-
- Default: ``(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$``
-:const-rgx:
- Regular expression which should only match correct module level names
-
- Default: ``(([A-Z_][A-Z0-9_]*)|(__.*__))$``
-:class-rgx:
- Regular expression which should only match correct class names
-
- Default: ``[A-Z_][a-zA-Z0-9]+$``
-:function-rgx:
- Regular expression which should only match correct function names
-
- Default: ``[a-z_][a-z0-9_]{2,30}$``
-:method-rgx:
- Regular expression which should only match correct method names
-
- Default: ``[a-z_][a-z0-9_]{2,30}$``
-:attr-rgx:
- Regular expression which should only match correct instance attribute names
-
- Default: ``[a-z_][a-z0-9_]{2,30}$``
-:argument-rgx:
- Regular expression which should only match correct argument names
-
- Default: ``[a-z_][a-z0-9_]{2,30}$``
-:variable-rgx:
- Regular expression which should only match correct variable names
-
- Default: ``[a-z_][a-z0-9_]{2,30}$``
-:inlinevar-rgx:
- Regular expression which should only match correct list comprehension /
- generator expression variable names
-
- Default: ``[A-Za-z_][A-Za-z0-9_]*$``
-:good-names:
- Good variable names which should always be accepted, separated by a comma
+:min-similarity-lines:
+ Minimum lines number of a similarity.
- Default: ``i,j,k,ex,Run,_``
-:bad-names:
- Bad variable names which should always be refused, separated by a comma
+ Default: ``4``
+:ignore-comments:
+ Ignore comments when computing similarities.
- Default: ``foo,bar,baz,toto,tutu,tata``
-:bad-functions:
- List of builtins function names that should not be used, separated by a comma
+ Default: ``yes``
+:ignore-docstrings:
+ Ignore docstrings when computing similarities.
- Default: ``map,filter,apply,input``
+ Default: ``yes``
Messages
~~~~~~~~
-:E0100: *__init__ method is a generator*
- Used when the special class method __init__ is turned into a generator by a
- yield in its body.
-:E0101: *Explicit return in __init__*
- Used when the special class method __init__ has an explicit return value.
-:E0102: *%s already defined line %s*
- Used when a function / class / method is redefined.
-:E0103: *%r not properly in loop*
- Used when break or continue keywords are used outside a loop.
-:E0104: *Return outside function*
- Used when a "return" statement is found outside a function or method.
-:E0105: *Yield outside function*
- Used when a "yield" statement is found outside a function or method.
-:E0106: *Return with argument inside generator*
- Used when a "return" statement with an argument is found outside in a
- generator function or method (e.g. with some "yield" statements).
-:W0101: *Unreachable code*
- Used when there is some code behind a "return" or "raise" statement, which
- will never be accessed.
-:W0102: *Dangerous default value %s as argument*
- Used when a mutable value as list or dictionary is detected in a default value
- for an argument.
-:W0104: *Statement seems to have no effect*
- Used when a statement doesn't have (or at least seems to) any effect.
-:W0105: *String statement has no effect*
- Used when a string is used as a statement (which of course has no effect).
- This is a particular case of W0104 with its own message so you can easily
- disable it if you're using those strings as documentation, instead of
- comments.
-:W0106: *Unnecessary semicolon*
- Used when a statement is ended by a semi-colon (";"), which isn't necessary
- (that's python, not C ;).
-:W0107: *Unnecessary pass statement*
- Used when a "pass" statement that can be avoided is encountered.)
-:W0122: *Use of the exec statement*
- Used when you use the "exec" statement, to discourage its usage. That doesn't
- mean you can not use it !
-:W0141: *Used builtin function %r*
- Used when a black listed builtin function is used (see the bad-function
- option). Usual black listed functions are the ones like map, or filter , where
- Python offers now some cleaner alternative like list comprehension.
-:W0142: *Used * or ** magic*
- Used when a function or method is called using `*args` or `**kwargs` to
- dispatch arguments. This doesn't improve readability and should be used with
- care.
-:C0102: *Black listed name "%s"*
- Used when the name is listed in the black list (unauthorized names).
-:C0103: *Invalid name "%s" (should match %s)*
- Used when the name doesn't match the regular expression associated to its type
- (constant, variable, class...).
-:C0111: *Missing docstring*
- Used when a module, function, class or method has no docstring. Some special
- methods like __init__ doesn't necessary require a docstring.
-:C0112: *Empty docstring*
- Used when a module, function, class or method has an empty docstring (it would
- be too easy ;).
-:C0121: *Missing required attribute "%s"*
- Used when an attribute required for modules is missing.
+:R0801: *Similar lines in %s files*
+ Indicates that a set of similar lines has been detected among multiple file.
+ This usually means that the code should be refactored to avoid this
+ duplication.
Reports
~~~~~~~
-:RP0101: Statistics by type
-
+:R0801: Duplication
-Typecheck checker
------------------
-try to find bugs in the code using type inference
+string_format checker
+---------------------
+Messages
+~~~~~~~~
+:E9900: *Unsupported format character %r (%#02x) at index %d*
+ Used when a unsupported format character is used in a format string.
+:E9901: *Format string ends in middle of conversion specifier*
+ Used when a format string terminates before the end of a conversion specifier.
+:E9902: *Mixing named and unnamed conversion specifiers in format string*
+ Used when a format string contains both named (e.g. '%(foo)d') and unnamed
+ (e.g. '%d') conversion specifiers. This is also used when a named conversion
+ specifier contains * for the minimum field width and/or precision.
+:E9903: *Expected mapping for format string, not %s*
+ Used when a format string that uses named conversion specifiers is used with
+ an argument that is not a mapping.
+:E9904: *Missing key %r in format string dictionary*
+ Used when a format string that uses named conversion specifiers is used with a
+ dictionary that doesn't contain all the keys required by the format string.
+:E9905: *Too many arguments for format string*
+ Used when a format string that uses unnamed conversion specifiers is given too
+ few arguments.
+:E9906: *Not enough arguments for format string*
+ Used when a format string that uses unnamed conversion specifiers is given too
+ many arguments
+:W9900: *Format string dictionary key should be a string, not %s*
+ Used when a format string that uses named conversion specifiers is used with a
+ dictionary whose keys are not all strings.
+:W9901: *Unused key %r in format string dictionary*
+ Used when a format string that uses named conversion specifiers is used with a
+ dictionary that conWtains keys not required by the format string.
+
+
+format checker
+--------------
Options
~~~~~~~
-:ignore-mixin-members:
- Tells whether missing members accessed in mixin class should be ignored. A
- mixin class is detected if its name ends with "mixin" (case insensitive).
+:max-line-length:
+ Maximum number of characters on a single line.
- Default: ``yes``
-:ignored-classes:
- List of classes names for which member attributes should not be checked
- (useful for classes with attributes dynamically set).
+ Default: ``80``
+:max-module-lines:
+ Maximum number of lines in a module
- Default: ``SQLObject``
-:zope:
- When zope mode is activated, add a predefined set of Zope acquired attributes
- to generated-members.
-:generated-members:
- List of members which are set dynamically and missed by pylint inference
- system, and so shouldn't trigger E0201 when accessed.
+ Default: ``1000``
+:indent-string:
+ String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
+ tab).
- Default: ``REQUEST,acl_users,aq_parent``
+ Default: ``' '``
Messages
~~~~~~~~
-:E1101: *%s %r has no %r member*
- Used when a variable is accessed for an unexistent member.
-:E1102: *%s is not callable*
- Used when an object being called has been inferred to a non callable object
-:E1103: *%s %r has no %r member (but some types could not be inferred)*
- Used when a variable is accessed for an unexistent member, but astng was not
- able to interpret all possible types of this variable.
-:E1111: *Assigning to function call which doesn't return*
- Used when an assignment is done on a function call but the inferred function
- doesn't return anything.
-:W1111: *Assigning to function call which only returns None*
- Used when an assignment is done on a function call but the inferred function
- returns nothing but None.
+:W0301: *Unnecessary semicolon*
+ Used when a statement is ended by a semi-colon (";"), which isn't necessary
+ (that's python, not C ;).
+:W0311: *Bad indentation. Found %s %s, expected %s*
+ Used when an unexpected number of indentation's tabulations or spaces has been
+ found.
+:W0312: *Found indentation with %ss instead of %ss*
+ Used when there are some mixed tabs and spaces in a module.
+:W0331: *Use of the <> operator*
+ Used when the deprecated "<>" operator is used instead of "!=".
+:W0332: *Use l as long integer identifier*
+ Used when a lower case "l" is used to mark a long integer. You should use a
+ upper case "L" since the letter "l" looks too much like the digit "1"
+:W0333: *Use of the `` operator*
+ Used when the deprecated "``" (backtick) operator is used instead of the str()
+ function.
+:C0301: *Line too long (%s/%s)*
+ Used when a line is longer than a given number of characters.
+:C0302: *Too many lines in module (%s)*
+ Used when a module has too much lines, reducing its readability.
+:C0321: *More than one statement on a single line*
+ Used when more than on statement are found on the same line.
+:C0322: *Operator not preceded by a space*
+ Used when one of the following operator (!= | <= | == | >= | < | > | = | \+= |
+ -= | \*= | /= | %) is not preceded by a space.
+:C0323: *Operator not followed by a space*
+ Used when one of the following operator (!= | <= | == | >= | < | > | = | \+= |
+ -= | \*= | /= | %) is not followed by a space.
+:C0324: *Comma not followed by a space*
+ Used when a comma (",") is not followed by a space.
+:F0321: *Format detection error in %r*
+ Used when an unexpected error occurred in bad format detection.Please report
+ the error if it occurs.
-Imports checker
+imports checker
---------------
-checks for
-* external modules dependencies
-* relative / wildcard imports
-* cyclic imports
-* uses of deprecated modules
-
Options
~~~~~~~
:deprecated-modules:
@@ -405,7 +242,7 @@ Messages
Used when `from module import *` is detected.
:W0402: *Uses of a deprecated module %r*
Used a module marked as deprecated is imported.
-:W0403: *Relative import %r*
+:W0403: *Relative import %r, should be %r*
Used when an import relative to the package directory is detected.
:W0404: *Reimport %r (imported line %s)*
Used when a module is reimported multiple times.
@@ -414,9 +251,9 @@ Messages
:W0410: *__future__ import is not the first non docstring statement*
Python 2.5 and greater require __future__ import to be the first non docstring
statement in the module.
-:RP0401: *Cyclic import (%s)*
+:R0401: *Cyclic import (%s)*
Used when a cyclic import between two or more modules is detected.
-:F0401: *Unable to import %r (%s)*
+:F0401: *Unable to import %r*
Used when pylint has been unable to import a module.
Reports
@@ -425,16 +262,91 @@ Reports
:RP0402: Modules dependencies graph
-Classes checker
+variables checker
+-----------------
+Options
+~~~~~~~
+:init-import:
+ Tells whether we should check for unused import in __init__ files.
+:dummy-variables-rgx:
+ A regular expression matching the beginning of the name of dummy variables
+ (i.e. not used).
+
+ Default: ``_|dummy``
+:additional-builtins:
+ List of additional names supposed to be defined in builtins. Remember that
+ you should avoid to define new builtins when possible.
+
+Messages
+~~~~~~~~
+:E0601: *Using variable %r before assignment*
+ Used when a local variable is accessed before it's assignment.
+:E0602: *Undefined variable %r*
+ Used when an undefined variable is accessed.
+:E0611: *No name %r in module %r*
+ Used when a name cannot be found in a module.
+:W0601: *Global variable %r undefined at the module level*
+ Used when a variable is defined through the "global" statement but the
+ variable is not defined in the module scope.
+:W0602: *Using global for %r but no assignment is done*
+ Used when a variable is defined through the "global" statement but no
+ assignment to this variable is done.
+:W0603: *Using the global statement*
+ Used when you use the "global" statement to update a global variable. PyLint
+ just try to discourage this usage. That doesn't mean you can not use it !
+:W0604: *Using the global statement at the module level*
+ Used when you use the "global" statement at the module level since it has no
+ effect
+:W0611: *Unused import %s*
+ Used when an imported module or variable is not used.
+:W0612: *Unused variable %r*
+ Used when a variable is defined but not used.
+:W0613: *Unused argument %r*
+ Used when a function or method argument is not used.
+:W0614: *Unused import %s from wildcard import*
+ Used when an imported module or variable is not used from a 'from X import *'
+ style import.
+:W0621: *Redefining name %r from outer scope (line %s)*
+ Used when a variable's name hide a name defined in the outer scope.
+:W0622: *Redefining built-in %r*
+ Used when a variable or function override a built-in.
+:W0631: *Using possibly undefined loop variable %r*
+ Used when an loop variable (i.e. defined by a for loop or a list comprehension
+ or a generator expression) is used outside the loop.
+
+
+miscellaneous checker
+---------------------
+Options
+~~~~~~~
+:notes:
+ List of note tags to take in consideration, separated by a comma.
+
+ Default: ``FIXME,XXX,TODO``
+
+Messages
+~~~~~~~~
+:E0501: *Non ascii characters found but no encoding specified (PEP 263)*
+ Used when some non ascii characters are detected but now encoding is
+ specified, as explicited in the PEP 263.
+:E0502: *Wrong encoding specified (%s)*
+ Used when a known encoding is specified but the file doesn't seem to be
+ actually in this encoding.
+:E0503: *Unknown encoding specified (%s)*
+ Used when an encoding is specified, but it's unknown to Python.
+:W0511:
+ Used when a warning note as FIXME or XXX is detected.
+
+
+metrics checker
---------------
-checks for :
-* methods without self as first argument
-* overridden methods signature
-* access only to existent members via self
-* attributes not defined in the __init__ method
-* supported interfaces implementation
-* unreachable code
+Reports
+~~~~~~~
+:RP0701: Raw metrics
+
+classes checker
+---------------
Options
~~~~~~~
:ignore-iface-methods:
@@ -459,8 +371,8 @@ Messages
no argument defined.
:E0213: *Method should have "self" as first argument*
Used when a method has an attribute different the "self" as first argument.
- This is considered as an error since this is a so common convention that
- you shouldn't break it!
+ This is considered as an error since this is a so common convention that you
+ shouldn't break it!
:E0221: *Interface resolved to %s is not a class*
Used when a class claims to implement an interface which is not a class.
:E0222: *Missing method %r from %s interface*
@@ -481,8 +393,8 @@ Messages
Used when a method signature is different than in the implemented interface or
in an overridden method.
:W0223: *Method %r is abstract in class %r but is not overridden*
- Used when an abstract method (i.e. raise NotImplementedError) is not overridden
- in concrete class.
+ Used when an abstract method (i.e. raise NotImplementedError) is not
+ overridden in concrete class.
:W0231: *__init__ method from base class %r is not called*
Used when an ancestor class method has an __init__ method which is not called
by a derived class.
@@ -507,18 +419,19 @@ Messages
Used when a PyLint as failed to find interfaces implemented by a class
-Design checker
+design checker
--------------
-checks for sign of poor/misdesign:
-* number of methods, attributes, local variables...
-* size, complexity of functions, methods
-
Options
~~~~~~~
:max-args:
Maximum number of arguments for function / method
Default: ``5``
+:ignored-argument-names:
+ Argument names that match this expression will be ignored. Default to name
+ with leading underscore
+
+ Default: ``_.*``
:max-locals:
Maximum number of locals for function / method body
@@ -586,33 +499,149 @@ Messages
Used when an interface class is not implemented anywhere.
-Newstyle checker
-----------------
-checks for usage of new style capabilities on old style classes and
-other new/old styles conflicts problems
-* use of property, __slots__, super
-* "super" usage
+basic checker
+-------------
+Options
+~~~~~~~
+:module-rgx:
+ Regular expression which should only match correct module names
+
+ Default: ``(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$``
+:const-rgx:
+ Regular expression which should only match correct module level names
+
+ Default: ``(([A-Z_][A-Z0-9_]*)|(__.*__))$``
+:class-rgx:
+ Regular expression which should only match correct class names
+
+ Default: ``[A-Z_][a-zA-Z0-9]+$``
+:function-rgx:
+ Regular expression which should only match correct function names
+
+ Default: ``[a-z_][a-z0-9_]{2,30}$``
+:method-rgx:
+ Regular expression which should only match correct method names
+
+ Default: ``[a-z_][a-z0-9_]{2,30}$``
+:attr-rgx:
+ Regular expression which should only match correct instance attribute names
+
+ Default: ``[a-z_][a-z0-9_]{2,30}$``
+:argument-rgx:
+ Regular expression which should only match correct argument names
+
+ Default: ``[a-z_][a-z0-9_]{2,30}$``
+:variable-rgx:
+ Regular expression which should only match correct variable names
+
+ Default: ``[a-z_][a-z0-9_]{2,30}$``
+:inlinevar-rgx:
+ Regular expression which should only match correct list comprehension /
+ generator expression variable names
+
+ Default: ``[A-Za-z_][A-Za-z0-9_]*$``
+:good-names:
+ Good variable names which should always be accepted, separated by a comma
+
+ Default: ``i,j,k,ex,Run,_``
+:bad-names:
+ Bad variable names which should always be refused, separated by a comma
+
+ Default: ``foo,bar,baz,toto,tutu,tata``
+:no-docstring-rgx:
+ Regular expression which should only match functions or classes name which do
+ not require a docstring
+
+ Default: ``__.*__``
+:required-attributes:
+ Required attributes for module, separated by a comma
+:bad-functions:
+ List of builtins function names that should not be used, separated by a comma
+
+ Default: ``map,filter,apply,input``
Messages
~~~~~~~~
-:E1001: *Use __slots__ on an old style class*
- Used when an old style class use the __slots__ attribute.
-:E1002: *Use super on an old style class*
- Used when an old style class use the super builtin.
-:E1003: *Bad first argument %r given to super class*
- Used when another argument than the current class is given as first argument
- of the super builtin.
-:W1001: *Use of "property" on an old style class*
- Used when PyLint detect the use of the builtin "property" on an old style
- class while this is relying on new style classes features
+:E0100: *__init__ method is a generator*
+ Used when the special class method __init__ is turned into a generator by a
+ yield in its body.
+:E0101: *Explicit return in __init__*
+ Used when the special class method __init__ has an explicit return value.
+:E0102: *%s already defined line %s*
+ Used when a function / class / method is redefined.
+:E0103: *%r not properly in loop*
+ Used when break or continue keywords are used outside a loop.
+:E0104: *Return outside function*
+ Used when a "return" statement is found outside a function or method.
+:E0105: *Yield outside function*
+ Used when a "yield" statement is found outside a function or method.
+:E0106: *Return with argument inside generator*
+ Used when a "return" statement with an argument is found outside in a
+ generator function or method (e.g. with some "yield" statements).
+:E0107: *Use of the non-existent %s operator*
+ Used when you attempt to use the C-style pre-increment orpre-decrement
+ operator -- and ++, which doesn't exist in Python.
+:W0101: *Unreachable code*
+ Used when there is some code behind a "return" or "raise" statement, which
+ will never be accessed.
+:W0102: *Dangerous default value %s as argument*
+ Used when a mutable value as list or dictionary is detected in a default value
+ for an argument.
+:W0104: *Statement seems to have no effect*
+ Used when a statement doesn't have (or at least seems to) any effect.
+:W0105: *String statement has no effect*
+ Used when a string is used as a statement (which of course has no effect).
+ This is a particular case of W0104 with its own message so you can easily
+ disable it if you're using those strings as documentation, instead of
+ comments.
+:W0107: *Unnecessary pass statement*
+ Used when a "pass" statement that can be avoided is encountered.)
+:W0108: *Lambda may not be necessary*
+ Used when the body of a lambda expression is a function call on the same
+ argument list as the lambda itself; such lambda expressions are in all but a
+ few cases replaceable with the function being called in the body of the
+ lambda.
+:W0109: *Duplicate key %r in dictionary*
+ Used when a dictionary expression binds the same key multiple times.
+:W0122: *Use of the exec statement*
+ Used when you use the "exec" statement, to discourage its usage. That doesn't
+ mean you can not use it !
+:W0141: *Used builtin function %r*
+ Used when a black listed builtin function is used (see the bad-function
+ option). Usual black listed functions are the ones like map, or filter , where
+ Python offers now some cleaner alternative like list comprehension.
+:W0142: *Used * or ** magic*
+ Used when a function or method is called using `*args` or `**kwargs` to
+ dispatch arguments. This doesn't improve readability and should be used with
+ care.
+:W0150: *%s statement in finally block may swallow exception*
+ Used when a break or a return statement is found inside the finally clause of
+ a try...finally block: the exceptions raised in the try clause will be
+ silently swallowed instead of being re-raised.
+:W0199: *Assert called on a 2-uple. Did you mean 'assert x,y'?*
+ A call of assert on a tuple will always evaluate to true if the tuple is not
+ empty, and will always evaluate to false if it is.
+:C0102: *Black listed name "%s"*
+ Used when the name is listed in the black list (unauthorized names).
+:C0103: *Invalid name "%s" (should match %s)*
+ Used when the name doesn't match the regular expression associated to its type
+ (constant, variable, class...).
+:C0111: *Missing docstring*
+ Used when a module, function, class or method has no docstring. Some special
+ methods like __init__ doesn't necessary require a docstring.
+:C0112: *Empty docstring*
+ Used when a module, function, class or method has an empty docstring (it would
+ be too easy ;).
+:C0121: *Missing required attribute "%s"*
+ Used when an attribute required for modules is missing.
+Reports
+~~~~~~~
+:RP0101: Statistics by type
-Exceptions checker
-------------------
-checks for
-* excepts without exception filter
-* type of raise argument : string, Exceptions, other values
+exceptions checker
+------------------
Messages
~~~~~~~~
:E0701: *Bad except clauses order (%s)*
@@ -625,6 +654,8 @@ Messages
:E0710: *Raising a new style class which doesn't inherit from BaseException*
Used when a new style class which doesn't inherit from BaseException raised
since it's not possible with python < 2.5.
+:E0711: *NotImplemented raised - should raise NotImplementedError*
+ Used when NotImplemented is raised instead of NotImplementedError
:W0701: *Raising a string exception*
Used when a string exception is raised.
:W0702: *No exception type(s) specified*
@@ -639,135 +670,72 @@ Messages
builtin "Exception" class.
-Similarities checker
---------------------
-checks for similarities and duplicated code. This computation may be
-memory / CPU intensive, so you should disable it if you experiments some
-problems.
-
-Options
-~~~~~~~
-:min-similarity-lines:
- Minimum lines number of a similarity.
-
- Default: ``4``
-:ignore-comments:
- Ignore comments when computing similarities.
-
- Default: ``yes``
-:ignore-docstrings:
- Ignore docstrings when computing similarities.
-
- Default: ``yes``
-
+newstyle checker
+----------------
Messages
~~~~~~~~
-:R0801: *Similar lines in %s files*
- Indicates that a set of similar lines has been detected among multiple file.
- This usually means that the code should be refactored to avoid this
- duplication.
-
-Reports
-~~~~~~~
-:R0801: Duplication
-
+:E1001: *Use __slots__ on an old style class*
+ Used when an old style class use the __slots__ attribute.
+:E1002: *Use super on an old style class*
+ Used when an old style class use the super builtin.
+:E1003: *Bad first argument %r given to super class*
+ Used when another argument than the current class is given as first argument
+ of the super builtin.
+:W1001: *Use of "property" on an old style class*
+ Used when PyLint detect the use of the builtin "property" on an old style
+ class while this is relying on new style classes features
-Format checker
---------------
-checks for :
-* unauthorized constructions
-* strict indentation
-* line length
-* use of <> instead of !=
+typecheck checker
+-----------------
Options
~~~~~~~
-:max-line-length:
- Maximum number of characters on a single line.
-
- Default: ``80``
-:max-module-lines:
- Maximum number of lines in a module
-
- Default: ``1000``
-:indent-string:
- String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
- tab).
-
- Default: ``' '``
-
-Messages
-~~~~~~~~
-:W0311: *Bad indentation. Found %s %s, expected %s*
- Used when an unexpected number of indentation's tabulations or spaces has been
- found.
-:W0312: *Found indentation with %ss instead of %ss*
- Used when there are some mixed tabs and spaces in a module.
-:W0331: *Use of the <> operator*
- Used when the deprecated "<>" operator is used instead of "!=".
-:W0332: *Use l as long integer identifier*
- Used when a lower case "l" is used to mark a long integer. You should use a
- upper case "L" since the letter "l" looks too much like the digit "1"
-:W0333: *Use of the `` operator*
- Used when the deprecated "``" (backtick) operator is used instead of the str()
- function.
-:C0301: *Line too long (%s/%s)*
- Used when a line is longer than a given number of characters.
-:C0302: *Too many lines in module (%s)*
- Used when a module has too much lines, reducing its readability.
-:C0321: *More than one statement on a single line*
- Used when more than on statement are found on the same line.
-:C0322: *Operator not preceded by a space*
- Used when one of the following operator (!= | <= | == | >= | < | > | = | \+= |
- -= | \*= | /= | %) is not preceded by a space.
-:C0323: *Operator not followed by a space*
- Used when one of the following operator (!= | <= | == | >= | < | > | = | \+= |
- -= | \*= | /= | %) is not followed by a space.
-:C0324: *Comma not followed by a space*
- Used when a comma (",") is not followed by a space.
-:F0321: *Format detection error in %r*
- Used when an unexpected error occurred in bad format detection.Please report
- the error if it occurs.
-
+:ignore-mixin-members:
+ Tells whether missing members accessed in mixin class should be ignored. A
+ mixin class is detected if its name ends with "mixin" (case insensitive).
-Miscellaneous checker
----------------------
-checks for:
-* warning notes in the code like FIXME, XXX
-* PEP 263: source code with non ascii character but no encoding declaration
+ Default: ``yes``
+:ignored-classes:
+ List of classes names for which member attributes should not be checked
+ (useful for classes with attributes dynamically set).
-Options
-~~~~~~~
-:notes:
- List of note tags to take in consideration, separated by a comma.
+ Default: ``SQLObject``
+:zope:
+ When zope mode is activated, add a predefined set of Zope acquired attributes
+ to generated-members.
+:generated-members:
+ List of members which are set dynamically and missed by pylint inference
+ system, and so shouldn't trigger E0201 when accessed.
- Default: ``FIXME,XXX,TODO``
+ Default: ``REQUEST,acl_users,aq_parent``
Messages
~~~~~~~~
-:E0501: *Non ascii characters found but no encoding specified (PEP 263)*
- Used when some non ascii characters are detected but now encoding is
- specified, as explicited in the PEP 263.
-:E0502: *Wrong encoding specified (%s)*
- Used when a known encoding is specified but the file doesn't seem to be
- actually in this encoding.
-:E0503: *Unknown encoding specified (%s)*
- Used when an encoding is specified, but it's unknown to Python.
-:W0511:
- Used when a warning note as FIXME or XXX is detected.
-
-
-Metrics checker
----------------
-does not check anything but gives some raw metrics :
-* total number of lines
-* total number of code lines
-* total number of docstring lines
-* total number of comments lines
-* total number of empty lines
-
-Reports
-~~~~~~~
-:R0701: Raw metrics
+:E1101: *%s %r has no %r member*
+ Used when a variable is accessed for an unexistent member.
+:E1102: *%s is not callable*
+ Used when an object being called has been inferred to a non callable object
+:E1103: *%s %r has no %r member (but some types could not be inferred)*
+ Used when a variable is accessed for an unexistent member, but astng was not
+ able to interpret all possible types of this variable.
+:E1111: *Assigning to function call which doesn't return*
+ Used when an assignment is done on a function call but the inferred function
+ doesn't return anything.
+:E1120: *No value passed for parameter %s in function call*
+ Used when a function call passes too few arguments.
+:E1121: *Too many positional arguments for function call*
+ Used when a function call passes too many positional arguments.
+:E1122: *Duplicate keyword argument %r in function call*
+ Used when a function call passes the same keyword argument multiple times.
+:E1123: *Passing unexpected keyword argument %r in function call*
+ Used when a function call passes a keyword argument that doesn't correspond to
+ one of the function's parameter names.
+:E1124: *Multiple values passed for parameter %r in function call*
+ Used when a function call would result in assigning multiple values to a
+ function parameter, one value from a positional argument and one from a
+ keyword argument.
+:W1111: *Assigning to function call which only returns None*
+ Used when an assignment is done on a function call but the inferred function
+ returns nothing but None.
diff --git a/doc/makefile b/doc/makefile
index 595869fbe..efbb5d7a3 100644
--- a/doc/makefile
+++ b/doc/makefile
@@ -23,11 +23,11 @@ features.html:
echo "PyLint features" > ${SRC}/features.txt
echo "===============" >> ${SRC}/features.txt
echo "" >> ${SRC}/features.txt
- echo ".. generated by pylint --list-msgs" >> ${SRC}/features.txt
+ echo ".. generated by pylint --full-documentation" >> ${SRC}/features.txt
echo "" >> ${SRC}/features.txt
echo ".. contents::" >> ${SRC}/features.txt
echo "" >> ${SRC}/features.txt
- pylint --list-msgs >> ${SRC}/features.txt
+ pylint --full-documentation >> ${SRC}/features.txt
${MKHTML} ${MKHTML_OPT} ${SRC}/features.txt
examples:
diff --git a/doc/manual.txt b/doc/manual.txt
index 9b227d9f7..3ea7c60ed 100644
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -278,11 +278,14 @@ First of all, we have two basic (but useful) options.
-h, --help show help about the command line options
Pylint is architectured around several checkers. By default all
-checkers are enabled. You can disable a specific checker by specifying
-``--enable-<checker>=n``, or disable all checkers using
-``--disable-all`` and afterwards enable specific checkers with
-``--enable-<checker>=y``. See the list of available features_ for a
+checkers are enabled. You can disable a specific checker or some of its
+messages or messages categories by specifying
+``--disable=<id>``. A more general disable can be enabled with
+or disable all checkers using
+``--enable=w<id>``. See the list of available features_ for a
description of provided checkers with their functionalities.
+The ``--disable`` and ``--enable`` options can be used with comma separated lists
+mixing checkers, message ids and categories like ``-d C,W,E0611,design``
Each checker has some specific options, which can take either a yes/no
value, an integer, a python regular expression, or a comma separated
@@ -309,11 +312,6 @@ Other useful global options include:
--comment=y_or_n Add a comment according to your evaluation note.
--parseable=y_or_n Use a parseable output format.
--html=y_or_n Use HTML as output format instead of text.
---enable-msg=msgids Enable the given messages.
---disable-msg=msgids Disable the given messages.
---enable-msg-cat=cats Enable all messages in the given categories.
---disable-msg-cat=cats Disable all messages in the given categories.
---errors-only Enable only checkers from the error category.
--list-msgs Generate pylint's messages.
--full-documentation Generate pylint's full documentation, in reST format.
@@ -344,9 +342,9 @@ python makes it hard enough, it is not the case for warnings.
- making all abstract methods explicit (rather than just not defining them in
the superclass)
- for messages which are useful in general, but not in a specific case: add "#
- pylint: disable-msg=X0123" comments
- - for PyLint bugs: add "#pylint: disable-msg=X0123" comments
- - for PyLint limitations: add "#pylint: disable-msg=X0123" comments
+ pylint: disable=X0123" comments
+ - for PyLint bugs: add "#pylint: disable=X0123" comments
+ - for PyLint limitations: add "#pylint: disable=X0123" comments
(for instance Twisted's modules create a lot of definitions dynamically so
PyLint does not know about them)
@@ -422,12 +420,12 @@ Messages control
An example available from the examples directory::
- """pylint option block-disable-msg"""
+ """pylint option block-disable"""
__revision__ = None
class Foo(object):
- """block-disable-msg test"""
+ """block-disable test"""
def __init__(self):
pass
@@ -438,34 +436,34 @@ An example available from the examples directory::
def meth2(self, arg):
"""and this one not"""
- # pylint: disable-msg=W0613
+ # pylint: disable=W0613
print self\
+ "foo"
def meth3(self):
"""test one line disabling"""
# no error
- print self.bla # pylint: disable-msg=E1101
+ print self.bla # pylint: disable=E1101
# error
print self.blop
def meth4(self):
"""test re-enabling"""
- # pylint: disable-msg=E1101
+ # pylint: disable=E1101
# no error
print self.bla
print self.blop
- # pylint: enable-msg=E1101
+ # pylint: enable=E1101
# error
print self.blip
def meth5(self):
"""test IF sub-block re-enabling"""
- # pylint: disable-msg=E1101
+ # pylint: disable=E1101
# no error
print self.bla
if self.blop:
- # pylint: enable-msg=E1101
+ # pylint: enable=E1101
# error
print self.blip
else:
@@ -476,14 +474,14 @@ An example available from the examples directory::
def meth6(self):
"""test TRY/EXCEPT sub-block re-enabling"""
- # pylint: disable-msg=E1101
+ # pylint: disable=E1101
# no error
print self.bla
try:
- # pylint: enable-msg=E1101
+ pylint: enable=E1101
# error
print self.blip
- except UndefinedName: # pylint: disable-msg=E0602
+ except UndefinedName: # pylint: disable=E0602
# no error
print self.blip
# no error
@@ -491,7 +489,7 @@ An example available from the examples directory::
def meth7(self):
"""test one line block opening disabling"""
- if self.blop: # pylint: disable-msg=E1101
+ if self.blop: # pylint: disable=E1101
# error
print self.blip
else:
@@ -505,7 +503,7 @@ An example available from the examples directory::
"""test late disabling"""
# error
print self.blip
- # pylint: disable-msg=E1101
+ # pylint: disable=E1101
# no error
print self.bla
print self.blop
diff --git a/examples/pylintrc b/examples/pylintrc
index 7d276cec5..a5b864156 100644
--- a/examples/pylintrc
+++ b/examples/pylintrc
@@ -57,11 +57,11 @@ reports=yes
# note). You have access to the variables errors warning, statement which
# respectively contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
-# (R0004).
+# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Add a comment according to your evaluation note. This is used by the global
-# evaluation report (R0004).
+# evaluation report (RP0004).
comment=no
diff --git a/lint.py b/lint.py
index 529d3fdd3..60ded6fe4 100644
--- a/lint.py
+++ b/lint.py
@@ -189,13 +189,13 @@ convention) / statement) * 10)',
than 10 (10 is the highest note). You have access to the variables errors \
warning, statement which respectively contain the number of errors / warnings\
messages and the total number of statements analyzed. This is used by the \
- global evaluation report (R0004).'}),
+ global evaluation report (RP0004).'}),
('comment',
{'default': 0, 'type' : 'yn', 'metavar' : '<y_or_n>',
'group': 'Reports', 'level': 1,
'help' : 'Add a comment according to your evaluation note. \
-This is used by the global evaluation report (R0004).'}),
+This is used by the global evaluation report (RP0004).'}),
('enable',
{'type' : 'csv', 'metavar': '<msg ids>',
diff --git a/man/pylint.1 b/man/pylint.1
index c68175507..38b7a91af 100644
--- a/man/pylint.1
+++ b/man/pylint.1
@@ -74,9 +74,9 @@ Put messages in a separate file for each module / package specified on the comma
.IP "--reports=<y_or_n>, -r <y_or_n>"
Tells whether to display a full report or only the messages [current: yes]
.IP "--evaluation=<python_expression>"
-Python expression which should return a note less than 10 (10 is the highest note). You have access to the variables errors warning, statement which respectively contain the number of errors / warnings messages and the total number of statements analyzed. This is used by the global evaluation report (R0004). [current: 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)]
+Python expression which should return a note less than 10 (10 is the highest note). You have access to the variables errors warning, statement which respectively contain the number of errors / warnings messages and the total number of statements analyzed. This is used by the global evaluation report (RP0004). [current: 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)]
.IP "--comment=<y_or_n>"
-Add a comment according to your evaluation note. This is used by the global evaluation report (R0004). [current: no]
+Add a comment according to your evaluation note. This is used by the global evaluation report (RP0004). [current: no]
.SH BASIC
.IP "--required-attributes=<attributes>"