Pylint features

Pylint global options and switches

Pylint provides global options and switches.

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 error mode, checkers without error messages are disabled and for others, only the ERROR messages are displayed, and no reports are done by default

py3k:

In Python 3 porting mode, all checkers will be disabled and only messages emitted by the porting checker will be displayed

profile:

Profiled execution.

ignore:

Add files or directories to the blacklist. They should be base names, not paths.

Default: CVS

persistent:

Pickle collected data for later comparisons.

Default: yes

load-plugins:

List of plugins (as comma separated values of python modules names) to load, usually to register additional checkers.

include-ids:

Deprecated. It was used to include message’s id in output. Use –msg-template instead.

symbols:

Deprecated. It was used to include symbolic ids of messages in output. Use –msg-template instead.

jobs:

Use multiple processes to speed up Pylint.

Default: 1

unsafe-load-any-extension:
 

Allow loading of arbitrary C extensions. Extensions are imported into the active Python interpreter and may run arbitrary code.

extension-pkg-whitelist:
 

A comma-separated list of package or module names from where C extensions may be loaded. Extensions are loading into the active Python interpreter and may run arbitrary code

optimize-ast:

Allow optimization of some AST trees. This will activate a peephole AST optimizer, which will apply various small optimizations. For instance, it can be used to obtain the result of joining multiple strings with the addition operator. Joining a lot of strings can lead to a maximum recursion error in Pylint and this flag can prevent that. It has one side effect, the resulting AST will be different than the one from reality.

long-help:

more verbose help.

Commands options

help-msg: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.
list-conf-levels:
 Generate pylint’s messages.
full-documentation:
 Generate pylint’s full documentation.
generate-rcfile:
 Generate a sample configuration file according to the current configuration. You can put other options before this one to get them in the generated configuration.
generate-man:Generate pylint’s man page.

Messages control options

confidence:

Only show warnings with the listed confidence levels. Leave empty to show all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED

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. See also the “–disable” option for examples.

disable:

Disable the message, report, category or checker with the given id(s). You can either give multiple identifiers separated by comma (,) or put this option multiple times (only on the command line, not in the configuration file where it should appear only once).You can also use “–disable=all” to disable everything first and then reenable specific checks. For example, if you want to run only the similarities checker, you can use “–disable=all –enable=similarities”. If you want to run only the classes checker, but have no Warning level messages displayed, use”–disable=all –enable=classes –disable=W”

Default: E1608,W1627,E1601,E1603,E1602,E1605,E1604,E1607,E1606,W1621,W1620,W1623,W1622,W1625,W1624,W1609,W1608,W1607,W1606,W1605,W1604,W1603,W1602,W1601,W1639,W1640,I0021,W1638,I0020,W1618,W1619,W1630,W1626,W1637,W1634,W1635,W1610,W1611,W1612,W1613,W1614,W1615,W1616,W1617,W1632,W1633,W0704,W1628,W1629,W1636

Reports options

output-format:

Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html. You can also give a reporter class, eg mypackage.mymodule.MyReporterClass.

Default: text

files-output:

Put messages in a separate file for each module / package specified on the command line instead of printing them on stdout. Reports (if any) will be written in a file name “pylint_global.[txt|html]”.

reports:

Tells whether to display a full report or only the messages

Default: yes

evaluation:

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).

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 (RP0004).

msg-template:

Template used to display messages. This is a python new-style format string used to format the message information. See doc for all details

Pylint checkers’ options and switches

Pylint checkers can provide three set of features:

  • options that control their execution,
  • messages that they can raise,
  • reports that they can generate.

Below is a list of all checkers and their features.

Logging checker

Verbatim name of the checker is logging.

Options

logging-modules:
 

Logging modules to check that the string format arguments are in logging function parameter format

Default: logging

Messages

logging-format-truncated (E1201):
 Logging format string ends in middle of conversion specifier Used when a logging statement format string terminates before the end of a conversion specifier.
logging-too-few-args (E1206):
 Not enough arguments for logging format string Used when a logging format string is given too many arguments
logging-too-many-args (E1205):
 Too many arguments for logging format string Used when a logging format string is given too few arguments.
logging-unsupported-format (E1200):
 Unsupported logging format character %r (%#02x) at index %d Used when an unsupported format character is used in a logging statement format string.
logging-not-lazy (W1201):
 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/.
logging-format-interpolation (W1202):
 Use % formatting in logging functions but pass the % parameters as arguments Used when a logging statement has a call form of “logging.<logging method>(format_string.format(format_args...))”. Such calls should use % formatting instead, but leave interpolation to the logging function by passing the parameters as arguments.

String Constant checker

Verbatim name of the checker is string_constant.

Messages

anomalous-unicode-escape-in-string (W1402):
 Anomalous Unicode escape in byte string: ‘%s’. String constant might be missing an r or u prefix. Used when an escape like u is encountered in a byte string where it has no effect.
anomalous-backslash-in-string (W1401):
 Anomalous backslash in string: ‘%s’. String constant might be missing an r prefix. Used when a backslash is in a literal string but not as an escape.

Format checker

Verbatim name of the checker is format.

Options

max-line-length:
 

Maximum number of characters on a single line.

Default: 100

ignore-long-lines:
 

Regexp for a line that is allowed to be longer than the limit.

Default: ^\s*(# )?<?https?://\S+>?$

single-line-if-stmt:
 

Allow the body of an if to be on the same line as the test if there is no else.

no-space-check:

List of optional constructs for which whitespace checking is disabled

Default: trailing-comma,dict-separator

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: '    '

indent-after-paren:
 

Number of spaces of indent required inside a hanging or continued line.

Default: 4

expected-line-ending-format:
 

Expected format of line ending, e.g. empty (any line ending), LF or CRLF.

Messages

bad-indentation (W0311):
 Bad indentation. Found %s %s, expected %s Used when an unexpected number of indentation’s tabulations or spaces has been found.
mixed-indentation (W0312):
 Found indentation with %ss instead of %ss Used when there are some mixed tabs and spaces in a module.
unnecessary-semicolon (W0301):
 Unnecessary semicolon Used when a statement is ended by a semi-colon (”;”), which isn’t necessary (that’s python, not C ;).
lowercase-l-suffix (W0332):
 Use of “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” This message can’t be emitted when using Python >= 3.0.
bad-whitespace (C0326):
 %s space %s %s %s Used when a wrong number of spaces is used around an operator, bracket or block opener.
missing-final-newline (C0304):
 Final newline missing Used when the last line in a file is missing a newline.
line-too-long (C0301):
 Line too long (%s/%s) Used when a line is longer than a given number of characters.
mixed-line-endings (C0327):
 Mixed line endings LF and CRLF Used when there are mixed (LF and CRLF) newline signs in a file.
multiple-statements (C0321):
 More than one statement on a single line Used when more than on statement are found on the same line.
too-many-lines (C0302):
 Too many lines in module (%s/%s) Used when a module has too much lines, reducing its readability.
trailing-whitespace (C0303):
 Trailing whitespace Used when there is whitespace between the end of a line and the newline.
unexpected-line-ending-format (C0328):
 Unexpected line ending format. There is ‘%s’ while it should be ‘%s’. Used when there is different newline than expected.
superfluous-parens (C0325):
 Unnecessary parens after %r keyword Used when a single item in parentheses follows an if, for, or other keyword.
bad-continuation (C0330):
 Wrong %s indentation%s. TODO

Typecheck checker

Verbatim name of the checker is typecheck.

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).

Default: yes

ignored-modules:
 

List of module names for which member attributes should not be checked (useful for modules/projects where namespaces are manipulated during runtime and thus existing member attributes cannot be deduced by static analysis

ignored-classes:
 

List of classes names for which member attributes should not be checked (useful for classes with attributes dynamically set).

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. Python regular expressions are accepted.

Default: REQUEST,acl_users,aq_parent

Messages

no-member (E1101):
 %s %r has no %r member Used when a variable is accessed for an unexistent member.
not-callable (E1102):
 %s is not callable Used when an object being called has been inferred to a non callable object
redundant-keyword-arg (E1124):
 Argument %r passed by position and keyword in %s 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.
assignment-from-no-return (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.
missing-kwoa (E1125):
 Missing mandatory keyword argument %r in %s call Used when a function call does not pass a mandatory keyword-only argument. This message can’t be emitted when using Python < 3.0.
no-value-for-parameter (E1120):
 No value for argument %s in %s call Used when a function call passes too few arguments.
invalid-sequence-index (E1126):
 Sequence index is not an int, slice, or instance with __index__ Used when a sequence type is indexed with an invalid type. Valid types are ints, slices, and objects with an __index__ method.
invalid-slice-index (E1127):
 Slice index is not an int, None, or instance with __index__ Used when a slice index is not an integer, None, or an object with an __index__ method.
too-many-function-args (E1121):
 Too many positional arguments for %s call Used when a function call passes too many positional arguments.
unexpected-keyword-arg (E1123):
 Unexpected keyword argument %r in %s call Used when a function call passes a keyword argument that doesn’t correspond to one of the function’s parameter names.
assignment-from-none (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.

Variables checker

Verbatim name of the checker is variables.

Options

init-import:

Tells whether we should check for unused import in __init__ files.

dummy-variables-rgx:
 

A regular expression matching the name of dummy variables (i.e. expectedly 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.

callbacks:

List of strings which can identify a callback function by name. A callback name must start or end with one of those strings.

Default: cb_,_cb

Messages

invalid-all-object (E0604):
 Invalid object %r in __all__, must contain only strings Used when an invalid (non-string) object occurs in __all__.
no-name-in-module (E0611):
 No name %r in module %r Used when a name cannot be found in a module.
undefined-variable (E0602):
 Undefined variable %r Used when an undefined variable is accessed.
undefined-all-variable (E0603):
 Undefined variable name %r in __all__ Used when an undefined variable name is referenced in __all__.
used-before-assignment (E0601):
 Using variable %r before assignment Used when a local variable is accessed before it’s assignment.
unpacking-non-sequence (W0633):
 Attempting to unpack a non-sequence%s Used when something which is not a sequence is used in an unpack assignment
cell-var-from-loop (W0640):
 Cell variable %s defined in loop A variable used in a closure is defined in a loop. This will result in all closures using the same value for the closed-over variable.
global-variable-undefined (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.
unbalanced-tuple-unpacking (W0632):
 Possible unbalanced tuple unpacking with sequence%s: left side has %d label(s), right side has %d value(s) Used when there is an unbalanced tuple unpacking in assignment
redefined-builtin (W0622):
 Redefining built-in %r Used when a variable or function override a built-in.
redefine-in-handler (W0623):
 Redefining name %r from %s in exception handler Used when an exception handler assigns the exception to an existing name
redefined-outer-name (W0621):
 Redefining name %r from outer scope (line %s) Used when a variable’s name hide a name defined in the outer scope.
unused-import (W0611):
 Unused %s Used when an imported module or variable is not used.
unused-argument (W0613):
 Unused argument %r Used when a function or method argument is not used.
unused-wildcard-import (W0614):
 Unused import %s from wildcard import Used when an imported module or variable is not used from a ‘from X import *‘ style import.
unused-variable (W0612):
 Unused variable %r Used when a variable is defined but not used.
global-variable-not-assigned (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.
undefined-loop-variable (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.
global-statement (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 !
global-at-module-level (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

Basic checker

Verbatim name of the checker is basic.

Options

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,input

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

name-group:

Colon-delimited sets of names that determine each other’s naming style when the name regexes allow several styles.

include-naming-hint:
 

Include a hint for the correct naming format with invalid-name

function-rgx:

Regular expression matching correct function names

Default: [a-z_][a-z0-9_]{2,30}$

function-name-hint:
 

Naming hint for function names

Default: [a-z_][a-z0-9_]{2,30}$

variable-rgx:

Regular expression matching correct variable names

Default: [a-z_][a-z0-9_]{2,30}$

variable-name-hint:
 

Naming hint for variable names

Default: [a-z_][a-z0-9_]{2,30}$

const-rgx:

Regular expression matching correct constant names

Default: (([A-Z_][A-Z0-9_]*)|(__.*__))$

const-name-hint:
 

Naming hint for constant names

Default: (([A-Z_][A-Z0-9_]*)|(__.*__))$

attr-rgx:

Regular expression matching correct attribute names

Default: [a-z_][a-z0-9_]{2,30}$

attr-name-hint:

Naming hint for attribute names

Default: [a-z_][a-z0-9_]{2,30}$

argument-rgx:

Regular expression matching correct argument names

Default: [a-z_][a-z0-9_]{2,30}$

argument-name-hint:
 

Naming hint for argument names

Default: [a-z_][a-z0-9_]{2,30}$

class-attribute-rgx:
 

Regular expression matching correct class attribute names

Default: ([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

class-attribute-name-hint:
 

Naming hint for class attribute names

Default: ([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

inlinevar-rgx:

Regular expression matching correct inline iteration names

Default: [A-Za-z_][A-Za-z0-9_]*$

inlinevar-name-hint:
 

Naming hint for inline iteration names

Default: [A-Za-z_][A-Za-z0-9_]*$

class-rgx:

Regular expression matching correct class names

Default: [A-Z_][a-zA-Z0-9]+$

class-name-hint:
 

Naming hint for class names

Default: [A-Z_][a-zA-Z0-9]+$

module-rgx:

Regular expression matching correct module names

Default: (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

module-name-hint:
 

Naming hint for module names

Default: (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

method-rgx:

Regular expression matching correct method names

Default: [a-z_][a-z0-9_]{2,30}$

method-name-hint:
 

Naming hint for method names

Default: [a-z_][a-z0-9_]{2,30}$

no-docstring-rgx:
 

Regular expression which should only match function or class names that do not require a docstring.

Default: __.*__

docstring-min-length:
 

Minimum line length for functions/classes that require docstrings, shorter ones are exempt.

Default: -1

Messages

not-in-loop (E0103):
 %r not properly in loop Used when break or continue keywords are used outside a loop.
function-redefined (E0102):
 %s already defined line %s Used when a function / class / method is redefined.
abstract-class-instantiated (E0110):
 Abstract class %r with abstract methods instantiated Used when an abstract class with abc.ABCMeta as metaclass has abstract methods and is instantiated.
duplicate-argument-name (E0108):
 Duplicate argument name %s in function definition Duplicate argument names in function definitions are syntax errors.
return-in-init (E0101):
 Explicit return in __init__ Used when the special class method __init__ has an explicit return value.
missing-reversed-argument (E0109):
 Missing argument to reversed() Used when reversed() builtin didn’t receive an argument.
return-outside-function (E0104):
 Return outside function Used when a “return” statement is found outside a function or method.
return-arg-in-generator (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). This message can’t be emitted when using Python >= 3.3.
bad-reversed-sequence (E0111):
 The first reversed() argument is not a sequence Used when the first argument to reversed() builtin isn’t a sequence (does not implement __reversed__, nor __getitem__ and __len__
nonexistent-operator (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.
yield-outside-function (E0105):
 Yield outside function Used when a “yield” statement is found outside a function or method.
init-is-generator (E0100):
 __init__ method is a generator Used when the special class method __init__ is turned into a generator by a yield in its body.
lost-exception (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.
assert-on-tuple (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.
dangerous-default-value (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.
duplicate-key (W0109):
 Duplicate key %r in dictionary Used when a dictionary expression binds the same key multiple times.
useless-else-on-loop (W0120):
 Else clause on loop without a break statement Loops should only have an else clause if they can exit early with a break statement, otherwise the statements under else should be on the same scope as the loop itself.
expression-not-assigned (W0106):
 Expression “%s” is assigned to nothing Used when an expression that is not a function call is assigned to nothing. Probably something else was intended.
unnecessary-lambda (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.
pointless-statement (W0104):
 Statement seems to have no effect Used when a statement doesn’t have (or at least seems to) any effect.
pointless-string-statement (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.
unnecessary-pass (W0107):
 Unnecessary pass statement Used when a “pass” statement that can be avoided is encountered.
unreachable (W0101):
 Unreachable code Used when there is some code behind a “return” or “raise” statement, which will never be accessed.
eval-used (W0123):
 Use of eval Used when you use the “eval” function, to discourage its usage. Consider using ast.literal_eval for safely evaluating strings containing Python expressions from untrusted sources.
exec-used (W0122):
 Use of exec Used when you use the “exec” statement (function for Python 3), to discourage its usage. That doesn’t mean you can not use it !
bad-builtin (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.
deprecated-lambda (W0110):
 map/filter on lambda could be replaced by comprehension Used when a lambda is the first argument to “map” or “filter”. It could be clearer as a list comprehension or generator expression. This message can’t be emitted when using Python >= 3.0.
blacklisted-name (C0102):
 Black listed name “%s” Used when the name is listed in the black list (unauthorized names).
empty-docstring (C0112):
 Empty %s docstring Used when a module, function, class or method has an empty docstring (it would be too easy ;).
invalid-name (C0103):
 Invalid %s name “%s”%s Used when the name doesn’t match the regular expression associated to its type (constant, variable, class...).
missing-docstring (C0111):
 Missing %s docstring Used when a module, function, class or method has no docstring.Some special methods like __init__ doesn’t necessary require a docstring.
missing-module-attribute (C0121):
 Missing required attribute “%s” Used when an attribute required for modules is missing.

Reports

RP0101:Statistics by type

Miscellaneous checker

Verbatim name of the checker is miscellaneous.

Options

notes:

List of note tags to take in consideration, separated by a comma.

Default: FIXME,XXX,TODO

Messages

fixme (W0511):Used when a warning note as FIXME or XXX is detected.
invalid-encoded-data (W0512):
 Cannot decode using encoding “%s”, unexpected byte at position %d Used when a source line cannot be decoded using the specified source file encoding. This message can’t be emitted when using Python >= 3.0.

Metrics checker

Verbatim name of the checker is metrics.

Reports

RP0701:Raw metrics

Imports checker

Verbatim name of the checker is imports.

Options

deprecated-modules:
 

Deprecated modules which should not be used, separated by a comma

Default: regsub,TERMIOS,Bastion,rexec

import-graph:

Create a graph of every (i.e. internal and external) dependencies in the given file (report RP0402 must not be disabled)

ext-import-graph:
 

Create a graph of external dependencies in the given file (report RP0402 must not be disabled)

int-import-graph:
 

Create a graph of internal dependencies in the given file (report RP0402 must not be disabled)

Messages

import-self (W0406):
 Module import itself Used when a module is importing itself.
reimported (W0404):
 Reimport %r (imported line %s) Used when a module is reimported multiple times.
relative-import (W0403):
 Relative import %r, should be %r Used when an import relative to the package directory is detected. This message can’t be emitted when using Python >= 3.0.
deprecated-module (W0402):
 Uses of a deprecated module %r Used a module marked as deprecated is imported.
wildcard-import (W0401):
 Wildcard import %s Used when from module import * is detected.
misplaced-future (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. This message can’t be emitted when using Python >= 3.0.
cyclic-import (R0401):
 Cyclic import (%s) Used when a cyclic import between two or more modules is detected.
import-error (F0401):
 Unable to import %s Used when pylint has been unable to import a module.

Reports

RP0401:External dependencies
RP0402:Modules dependencies graph

Classes checker

Verbatim name of the checker is classes.

Options

ignore-iface-methods:
 

List of interface methods to ignore, separated by a comma. This is used for instance to not check methods defines in Zope’s Interface base class.

Default: isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by

defining-attr-methods:
 

List of method names used to declare (i.e. assign) instance attributes.

Default: __init__,__new__,setUp

valid-classmethod-first-arg:
 

List of valid names for the first argument in a class method.

Default: cls

valid-metaclass-classmethod-first-arg:
 

List of valid names for the first argument in a metaclass class method.

Default: mcs

exclude-protected:
 

List of member names, which should be excluded from the protected access warning.

Default: _asdict,_fields,_replace,_source,_make

Messages

access-member-before-definition (E0203):
 Access to member %r before its definition line %s Used when an instance member is accessed before it’s actually assigned.
method-hidden (E0202):
 An attribute defined in %s line %s hides this method Used when a class defines a method which is hidden by an instance attribute from an ancestor class or set by some client code.
assigning-non-slot (E0237):
 Assigning to attribute %r not defined in class slots Used when assigning to an attribute not defined in the class slots.
inherit-non-class (E0239):
 Inheriting %r, which is not a class. Used when a class inherits from something which is not a class.
interface-is-not-class (E0221):
 Interface resolved to %s is not a class Used when a class claims to implement an interface which is not a class.
invalid-slots (E0238):
 Invalid __slots__ object Used when an invalid __slots__ is found in class. Only a string, an iterable or a sequence is permitted.
invalid-slots-object (E0236):
 Invalid object %r in __slots__, must contain only non empty strings Used when an invalid (non-string) object occurs in __slots__.
no-method-argument (E0211):
 Method has no argument Used when a method which should have the bound instance as first argument has no argument defined.
no-self-argument (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!
missing-interface-method (E0222):
 Missing method %r from %s interface Used when a method declared in an interface is missing from a class implementing this interface
bad-context-manager (E0235):
 __exit__ must accept 3 arguments: type, value, traceback Used when the __exit__ special method, belonging to a context manager, does not accept 3 arguments (type, value, traceback).
protected-access (W0212):
 Access to a protected member %s of a client class Used when a protected member (i.e. class member with a name beginning with an underscore) is access outside the class or a descendant of the class where it’s defined.
arguments-differ (W0221):
 Arguments number differs from %s %r method Used when a method has a different number of arguments than in the implemented interface or in an overridden method.
attribute-defined-outside-init (W0201):
 Attribute %r defined outside __init__ Used when an instance attribute is defined outside the __init__ method.
no-init (W0232):
 Class has no __init__ method Used when a class has no __init__ method, neither its parent classes.
abstract-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.
signature-differs (W0222):
 Signature differs from %s %r method Used when a method signature is different than in the implemented interface or in an overridden method.
bad-staticmethod-argument (W0211):
 Static method with %r as first argument Used when a static method has “self” or a value specified in valid-classmethod-first-arg option or valid-metaclass-classmethod-first-arg option as first argument.
non-parent-init-called (W0233):
 __init__ method from a non direct base class %r is called Used when an __init__ method is called on a class which is not in the direct ancestors for the analysed class.
super-init-not-called (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.
non-iterator-returned (W0234):
 __iter__ returns non-iterator Used when an __iter__ method returns something which is not an iterable (i.e. has no next method)
no-self-use (R0201):
 Method could be a function Used when a method doesn’t use its bound instance, and so could be written as a function.
bad-classmethod-argument (C0202):
 Class method %s should have %s as first argument Used when a class method has a first argument named differently than the value specified in valid-classmethod-first-arg option (default to “cls”), recommended to easily differentiate them from regular instance methods.
bad-mcs-classmethod-argument (C0204):
 Metaclass class method %s should have %s as first argument Used when a metaclass class method has a first argument named differently than the value specified in valid-metaclass-classmethod-first-arg option (default to “mcs”), recommended to easily differentiate them from regular instance methods.
bad-mcs-method-argument (C0203):
 Metaclass method %s should have %s as first argument Used when a metaclass method has a first agument named differently than the value specified in valid-classmethod-first-arg option (default to “cls”), recommended to easily differentiate them from regular instance methods.
method-check-failed (F0202):
 Unable to check methods signature (%s / %s) Used when Pylint has been unable to check methods signature compatibility for an unexpected reason. Please report this kind if you don’t make sense of it.
unresolved-interface (F0220):
 failed to resolve interfaces implemented by %s (%s) Used when a Pylint as failed to find interfaces implemented by a class

Design checker

Verbatim name of the checker is design.

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

Default: 15

max-returns:

Maximum number of return / yield for function / method body

Default: 6

max-branches:

Maximum number of branch for function / method body

Default: 12

max-statements:

Maximum number of statements in function / method body

Default: 50

max-parents:

Maximum number of parents for a class (see R0901).

Default: 7

max-attributes:

Maximum number of attributes for a class (see R0902).

Default: 7

min-public-methods:
 

Minimum number of public methods for a class (see R0903).

Default: 2

max-public-methods:
 

Maximum number of public methods for a class (see R0904).

Default: 20

Messages

interface-not-implemented (R0923):
 Interface not implemented Used when an interface class is not implemented anywhere.
too-few-public-methods (R0903):
 Too few public methods (%s/%s) Used when class has too few public methods, so be sure it’s really worth it.
too-many-ancestors (R0901):
 Too many ancestors (%s/%s) Used when class has too many parent classes, try to reduce this to get a simpler (and so easier to use) class.
too-many-arguments (R0913):
 Too many arguments (%s/%s) Used when a function or method takes too many arguments.
too-many-branches (R0912):
 Too many branches (%s/%s) Used when a function or method has too many branches, making it hard to follow.
too-many-instance-attributes (R0902):
 Too many instance attributes (%s/%s) Used when class has too many instance attributes, try to reduce this to get a simpler (and so easier to use) class.
too-many-locals (R0914):
 Too many local variables (%s/%s) Used when a function or method has too many local variables.
too-many-public-methods (R0904):
 Too many public methods (%s/%s) Used when class has too many public methods, try to reduce this to get a simpler (and so easier to use) class.
too-many-return-statements (R0911):
 Too many return statements (%s/%s) Used when a function or method has too many return statement, making it hard to follow.
too-many-statements (R0915):
 Too many statements (%s/%s) Used when a function or method has too many statements. You should then split it in smaller functions / methods.

Stdlib checker

Verbatim name of the checker is stdlib.

Messages

bad-open-mode (W1501):
 “%s” is not a valid mode for open. Python supports: r, w, a[, x] modes with b, +, and U (only with r) options. See http://docs.python.org/2/library/functions.html#open
redundant-unittest-assert (W1503):
 Redundant use of %s with constant value %r The first argument of assertTrue and assertFalse is a condition. If a constant is passed as parameter, that condition will be always true. In this case a warning should be emitted.
boolean-datetime (W1502):
 Using datetime.time in a boolean context. Using datetime.time in a boolean context can hide subtle bugs when the time they represent matches midnight UTC. This behaviour was fixed in Python 3.5. See http://bugs.python.org/issue13936 for reference. This message can’t be emitted when using Python >= 3.5.
unidiomatic-typecheck (W1504):
 Using type() instead of isinstance() for a typecheck. The idiomatic way to perform an explicit typecheck in Python is to use isinstance(x, Y) rather than type(x) == Y, type(x) is Y. Though there are unusual situations where these give different results.

Similarities checker

Verbatim name of the checker is similarities.

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

ignore-imports:

Ignore imports when computing similarities.

Messages

duplicate-code (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

RP0801:Duplication

Exceptions checker

Verbatim name of the checker is exceptions.

Options

overgeneral-exceptions:
 

Exceptions that will emit a warning when being caught. Defaults to “Exception”

Default: Exception

Messages

bad-except-order (E0701):
 Bad except clauses order (%s) Used when except clauses are not in the correct order (from the more specific to the more generic). If you don’t fix the order, some exceptions may not be catched by the most specific handler.
catching-non-exception (E0712):
 Catching an exception which doesn’t inherit from BaseException: %s Used when a class which doesn’t inherit from BaseException is used as an exception in an except clause.
bad-exception-context (E0703):
 Exception context set to something which is not an exception, nor None Used when using the syntax “raise ... from ...”, where the exception context is not an exception, nor None. This message can’t be emitted when using Python < 3.0.
notimplemented-raised (E0711):
 NotImplemented raised - should raise NotImplementedError Used when NotImplemented is raised instead of NotImplementedError
raising-bad-type (E0702):
 Raising %s while only classes or instances are allowed Used when something which is neither a class, an instance or a string is raised (i.e. a TypeError will be raised).
raising-non-exception (E0710):
 Raising a new style class which doesn’t inherit from BaseException Used when a new style class which doesn’t inherit from BaseException is raised.
broad-except (W0703):
 Catching too general exception %s Used when an except catches a too general exception, possibly burying unrelated errors.
pointless-except (W0704):
 Except doesn’t do anything Used when an except clause does nothing but “pass” and there is no “else” clause.
nonstandard-exception (W0710):
 Exception doesn’t inherit from standard “Exception” class Used when a custom exception class is raised but doesn’t inherit from the builtin “Exception” class. This message can’t be emitted when using Python >= 3.0.
binary-op-exception (W0711):
 Exception to catch is the result of a binary “%s” operation Used when the exception to catch is of the form “except A or B:”. If intending to catch multiple, rewrite as “except (A, B):”
bare-except (W0702):
 No exception type(s) specified Used when an except clause doesn’t specify exceptions type to catch.

Newstyle checker

Verbatim name of the checker is newstyle.

Messages

bad-super-call (E1003):
 Bad first argument %r given to super() Used when another argument than the current class is given as first argument of the super builtin.
missing-super-argument (E1004):
 Missing argument to super() Used when the super builtin didn’t receive an argument. This message can’t be emitted when using Python >= 3.0.
slots-on-old-class (E1001):
 Use of __slots__ on an old style class Used when an old style class uses the __slots__ attribute. This message can’t be emitted when using Python >= 3.0.
super-on-old-class (E1002):
 Use of super on an old style class Used when an old style class uses the super builtin. This message can’t be emitted when using Python >= 3.0.
property-on-old-class (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. This message can’t be emitted when using Python >= 3.0.
old-style-class (C1001):
 Old-style class defined. Used when a class is defined that does not inherit from anotherclass and does not inherit explicitly from “object”. This message can’t be emitted when using Python >= 3.0.

Spelling checker

Verbatim name of the checker is spelling.

Options

spelling-dict:Spelling dictionary name. Available dictionaries: en (aspell), en_CA (aspell), en_GB (aspell), en_US (aspell), fr_CH (myspell), fr_CA (myspell), fr_LU (myspell), fr_BE (myspell), fr_MC (myspell), fr_FR (myspell), fr (myspell).
spelling-ignore-words:
 List of comma separated words that should not be checked.
spelling-private-dict-file:
 A path to a file that contains private dictionary; one word per line.
spelling-store-unknown-words:
 Tells whether to store unknown words to indicated private dictionary in –spelling-private-dict-file option instead of raising a message.

Messages

invalid-characters-in-docstring (C0403):
 Invalid characters %r in a docstring Used when a word in docstring cannot be checked by enchant.
wrong-spelling-in-comment (C0401):
 Wrong spelling of a word ‘%s’ in a comment: Used when a word in comment is not spelled correctly.
wrong-spelling-in-docstring (C0402):
 Wrong spelling of a word ‘%s’ in a docstring: Used when a word in docstring is not spelled correctly.

Python3 checker

Verbatim name of the checker is python3.

Messages

unpacking-in-except (E1603):
 Implicit unpacking of exceptions is not supported in Python 3 Python3 will not allow implicit unpacking of exceptions in except clauses. See http://www.python.org/dev/peps/pep-3110/ This message can’t be emitted when using Python >= 3.0.
parameter-unpacking (E1602):
 Parameter unpacking specified Used when parameter unpacking is specified for a function(Python 3 doesn’t allow it) This message can’t be emitted when using Python >= 3.0.
long-suffix (E1606):
 Use of long suffix Used when “l” or “L” is used to mark a long integer. This will not work in Python 3, since int and long types have merged. This message can’t be emitted when using Python >= 3.0.
old-octal-literal (E1608):
 Use of old octal literal Usen when encountering the old octal syntax, removed in Python 3. To use the new syntax, prepend 0o on the number. This message can’t be emitted when using Python >= 3.0.
old-ne-operator (E1607):
 Use of the <> operator Used when the deprecated “<>” operator is used instead of ”!=”. This is removed in Python 3. This message can’t be emitted when using Python >= 3.0.
backtick (E1605):
 Use of the `` operator Used when the deprecated “``” (backtick) operator is used instead of the str() function. This message can’t be emitted when using Python >= 3.0.
old-raise-syntax (E1604):
 Use raise ErrorClass(args) instead of raise ErrorClass, args. Used when the alternate raise syntax ‘raise foo, bar’ is used instead of ‘raise foo(bar)’. This message can’t be emitted when using Python >= 3.0.
print-statement (E1601):
 print statement used Used when a print statement is used (print is a function in Python 3) This message can’t be emitted when using Python >= 3.0.
metaclass-assignment (W1623):
 Assigning to a class’ __metaclass__ attribute Used when a metaclass is specified by assigning to __metaclass__ (Python 3 specifies the metaclass as a class statement argument) This message can’t be emitted when using Python >= 3.0.
next-method-called (W1622):
 Called a next() method on an object Used when an object’s next() method is called (Python 3 uses the next() built-in function) This message can’t be emitted when using Python >= 3.0.
dict-iter-method (W1620):
 Calling a dict.iter*() method Used for calls to dict.iterkeys(), itervalues() or iteritems() (Python 3 lacks these methods) This message can’t be emitted when using Python >= 3.0.
dict-view-method (W1621):
 Calling a dict.view*() method Used for calls to dict.viewkeys(), viewvalues() or viewitems() (Python 3 lacks these methods) This message can’t be emitted when using Python >= 3.0.
indexing-exception (W1624):
 Indexing exceptions will not work on Python 3 Indexing exceptions will not work on Python 3. Use exception.args[index] instead. This message can’t be emitted when using Python >= 3.0.
raising-string (W1625):
 Raising a string exception Used when a string exception is raised. This will not work on Python 3. This message can’t be emitted when using Python >= 3.0.
standarderror-builtin (W1611):
 StandardError built-in referenced Used when the StandardError built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
using-cmp-argument (W1640):
 Using the cmp argument for list.sort / sorted Using the cmp argument for list.sort or the sorted builtin should be avoided, since it was removed in Python 3. Using either key or functools.cmp_to_key should be preferred. This message can’t be emitted when using Python >= 3.0.
cmp-method (W1630):
 __cmp__ method defined Used when a __cmp__ method is defined (method is not used by Python 3) This message can’t be emitted when using Python >= 3.0.
coerce-method (W1614):
 __coerce__ method defined Used when a __coerce__ method is defined (method is not used by Python 3) This message can’t be emitted when using Python >= 3.0.
delslice-method (W1615):
 __delslice__ method defined Used when a __delslice__ method is defined (method is not used by Python 3) This message can’t be emitted when using Python >= 3.0.
getslice-method (W1616):
 __getslice__ method defined Used when a __getslice__ method is defined (method is not used by Python 3) This message can’t be emitted when using Python >= 3.0.
hex-method (W1628):
 __hex__ method defined Used when a __hex__ method is defined (method is not used by Python 3) This message can’t be emitted when using Python >= 3.0.
nonzero-method (W1629):
 __nonzero__ method defined Used when a __nonzero__ method is defined (method is not used by Python 3) This message can’t be emitted when using Python >= 3.0.
oct-method (W1627):
 __oct__ method defined Used when a __oct__ method is defined (method is not used by Python 3) This message can’t be emitted when using Python >= 3.0.
setslice-method (W1617):
 __setslice__ method defined Used when a __setslice__ method is defined (method is not used by Python 3) This message can’t be emitted when using Python >= 3.0.
apply-builtin (W1601):
 apply built-in referenced Used when the apply built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
basestring-builtin (W1602):
 basestring built-in referenced Used when the basestring built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
buffer-builtin (W1603):
 buffer built-in referenced Used when the buffer built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
cmp-builtin (W1604):
 cmp built-in referenced Used when the cmp built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
coerce-builtin (W1605):
 coerce built-in referenced Used when the coerce built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
old-division (W1619):
 division w/o __future__ statement Used for non-floor division w/o a float literal or from __future__ import division (Python 3 returns a float for int division unconditionally) This message can’t be emitted when using Python >= 3.0.
execfile-builtin (W1606):
 execfile built-in referenced Used when the execfile built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
file-builtin (W1607):
 file built-in referenced Used when the file built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
filter-builtin-not-iterating (W1639):
 filter built-in referenced when not iterating Used when the filter built-in is referenced in a non-iterating context (returns an iterator in Python 3) This message can’t be emitted when using Python >= 3.0.
no-absolute-import (W1618):
 import missing `from __future__ import absolute_import` Used when an import is not accompanied by from __future__ import absolute_import (default behaviour in Python 3) This message can’t be emitted when using Python >= 3.0.
input-builtin (W1632):
 input built-in referenced Used when the input built-in is referenced (backwards-incompatible semantics in Python 3) This message can’t be emitted when using Python >= 3.0.
intern-builtin (W1634):
 intern built-in referenced Used when the intern built-in is referenced (Moved to sys.intern in Python 3) This message can’t be emitted when using Python >= 3.0.
long-builtin (W1608):
 long built-in referenced Used when the long built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
map-builtin-not-iterating (W1636):
 map built-in referenced when not iterating Used when the map built-in is referenced in a non-iterating context (returns an iterator in Python 3) This message can’t be emitted when using Python >= 3.0.
range-builtin-not-iterating (W1638):
 range built-in referenced when not iterating Used when the range built-in is referenced in a non-iterating context (returns an iterator in Python 3) This message can’t be emitted when using Python >= 3.0.
raw_input-builtin (W1609):
 raw_input built-in referenced Used when the raw_input built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
reduce-builtin (W1610):
 reduce built-in referenced Used when the reduce built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
reload-builtin (W1626):
 reload built-in referenced Used when the reload built-in function is referenced (missing from Python 3). You can use instead imp.reload or importlib.reload. This message can’t be emitted when using Python >= 3.0.
round-builtin (W1633):
 round built-in referenced Used when the round built-in is referenced (backwards-incompatible semantics in Python 3) This message can’t be emitted when using Python >= 3.0.
unichr-builtin (W1635):
 unichr built-in referenced Used when the unichr built-in is referenced (Use chr in Python 3) This message can’t be emitted when using Python >= 3.0.
unicode-builtin (W1612):
 unicode built-in referenced Used when the unicode built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
xrange-builtin (W1613):
 xrange built-in referenced Used when the xrange built-in function is referenced (missing from Python 3) This message can’t be emitted when using Python >= 3.0.
zip-builtin-not-iterating (W1637):
 zip built-in referenced when not iterating Used when the zip built-in is referenced in a non-iterating context (returns an iterator in Python 3) This message can’t be emitted when using Python >= 3.0.

String checker

Verbatim name of the checker is string.

Messages

format-needs-mapping (E1303):
 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.
truncated-format-string (E1301):
 Format string ends in middle of conversion specifier Used when a format string terminates before the end of a conversion specifier.
missing-format-string-key (E1304):
 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.
mixed-format-string (E1302):
 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.
too-few-format-args (E1306):
 Not enough arguments for format string Used when a format string that uses unnamed conversion specifiers is given too few arguments
bad-str-strip-call (E1310):
 Suspicious argument in %s.%s call The argument to a str.{l,r,}strip call contains a duplicate character,
too-many-format-args (E1305):
 Too many arguments for format string Used when a format string that uses unnamed conversion specifiers is given too many arguments.
bad-format-character (E1300):
 Unsupported format character %r (%#02x) at index %d Used when a unsupported format character is used in a format string.
format-combined-specification (W1305):
 Format string contains both automatic field numbering and manual field specification Usen when a PEP 3101 format string contains both automatic field numbering (e.g. ‘{}’) and manual field specification (e.g. ‘{0}’). This message can’t be emitted when using Python < 2.7.
bad-format-string-key (W1300):
 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.
bad-format-string (W1302):
 Invalid format string Used when a PEP 3101 format string is invalid. This message can’t be emitted when using Python < 2.7.
missing-format-attribute (W1306):
 Missing format attribute %r in format specifier %r Used when a PEP 3101 format string uses an attribute specifier ({0.length}), but the argument passed for formatting doesn’t have that attribute. This message can’t be emitted when using Python < 2.7.
missing-format-argument-key (W1303):
 Missing keyword argument %r for format string Used when a PEP 3101 format string that uses named fields doesn’t receive one or more required keywords. This message can’t be emitted when using Python < 2.7.
unused-format-string-argument (W1304):
 Unused format argument %r Used when a PEP 3101 format string that uses named fields is used with an argument that is not required by the format string. This message can’t be emitted when using Python < 2.7.
unused-format-string-key (W1301):
 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.
invalid-format-index (W1307):
 Using invalid lookup key %r in format specifier %r Used when a PEP 3101 format string uses a lookup specifier ({a[1]}), but the argument passed for formatting doesn’t contain or doesn’t have that key as an attribute. This message can’t be emitted when using Python < 2.7.