1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
**************************
What's New In Pylint 1.6
**************************
:Release: 1.6.0
:Date: 2016-07-07
Summary -- Release highlights
=============================
Nothing major.
New checkers
============
* We added a new recommendation check, ``consider-iterating-dictionary``,
which is emitted when a dictionary is iterated by using ``.keys()``.
For instance, the following code would trigger this warning, since
the dictionary's keys can be iterated without calling the method explicitly.
.. code-block:: python
for key in dictionary.keys():
...
# Can be refactored to:
for key in dictionary:
...
* ``trailing-newlines`` check was added, which is emitted when a file has trailing newlines.
* ``invalid-length-returned`` check was added, which is emitted when the ``__len__``
special method returns something else than a non-negative number. For instance, this
example is triggering it::
class Container(object):
def __len__(self):
return self._items # Oups, forgot to call len() over it.
* Add a new check to the *check_docs* extension for looking for duplicate
constructor parameters in a class constructor docstring or in a class docstring.
The check ``multiple-constructor-doc`` is emitted when the parameter is documented
in both places.
* We added a new extension plugin, ``pylint.extensions.mccabe``, which can be used
for warning about the complexity in the code.
You can enable it as in::
$ pylint module_or_project --load-plugins=pylint.extensions.mccabe
See more at :ref:`pylint.extensions.mccabe`
New features
============
* ``generated-members`` now supports qualified names through regular expressions.
For instance, for ignoring all the errors generated by ``numpy.core``'s attributes, we can
now use::
$ pylint a.py --generated-members=numpy.*
* Add the ability to ignore files based on regex matching, with the new ``--ignore-patterns`` option.
Rather than clobber the existing ``ignore`` option, we decided to have a separate
option for it. For instance, for ignoring all the test files, we can now use::
$ pylint myproject --ignore-patterns=test.*?py
* We added a new option, ``redefining-builtins-modules``, which is used for
defining the modules which can redefine builtins.
*pylint* will emit an error when a builtin is redefined, such as defining
a variable called ``next``. But in some cases, the builtins can be
redefined in the case they are imported from other places, different
than the ``builtins`` module, such is the case for ``six.moves``, which
contains more forward-looking functions::
$ cat a.py
# Oups, now pylint emits a redefined-builtin message.
from six.moves import open
$ pylint a.py --redefining-builtins-modules=six.moves
Default values: ``six.moves,future.builtins``
Bug fixes
=========
* Fixed a bug where the top name of a qualified import was detected as an unused variable.
* We don't warn about ``invalid-sequence-index`` if the indexed object has unknown
base classes, that Pylint cannot deduce.
Other Changes
=============
* The ``bad-builtin`` check was moved into an extension.
The check was complaining about used builtin functions which
were supposed to not be used. For instance, ``map`` and ``filter``
were falling into this category, since better alternatives can
be used, such as list comprehensions. But the check was annoying,
since using ``map`` or ``filter`` can have its use cases and as
such, we decided to move it to an extension check instead.
It can now be enabled through ``--load-plugins=pylint.extensions.bad_builtin``.
* We use the ``configparser`` backport internally, for Python 2.
This allows having comments inside list values, in the configuration,
such as::
disable=no-member,
# Don't like this check
bad-indentation
* We now use the isort_ package internally.
This improves the ```wrong-import-order`` check, so now
we should have less false positives regarding the import order.
* We do not emit ``import-error`` or ``no-name-in-module`` for fallback import blocks by default.
A fallback import block can be considered a TryExcept block, which contains imports in both
branches, such as::
try:
import urllib.request as request
except ImportError:
import urllib2 as request
In the case where **pylint** can not find one import from the ``except`` branch, then
it will emit an ``import-error``, but this gets cumbersome when trying to write
compatible code for both Python versions. As such, we don't check these blocks by default,
but the analysis can be enforced by using the new ``--analyse-fallback-block`` flag.
* ``reimported`` is emitted when the same name is imported from different module, as in::
from collections import deque, OrderedDict, deque
Deprecated features
===================
* The HTML support was deprecated and will be eventually removed
in Pylint 1.7.0.
This feature was lately a second class citizen in Pylint, being
often neglected and having a couple of bugs. Since we now have
the JSON reporter, this can be used as a basis for more prettier
HTML outputs than what Pylint can currently offer.
* The ``--files-output`` option was deprecated and will be eventually
removed in Pylint 1.7.0.
* The ``--optimize-ast`` option was deprecated and will be eventually
removed in Pylint 1.7.0.
The option was initially added for handling pathological cases,
such as joining too many strings using the addition operator, which
was leading pylint to have a recursion error when trying to figure
out what the string was. Unfortunately, we decided to ignore the
issue, since the pathological case would have happen when the
code was parsed by Python as well, without actually reaching the
runtime step and as such, we will remove the option in the future.
* The ``check_docs`` extension is now deprecated. The extension is still available
under the ``docparams`` name, so this should work::
$ pylint module_or_package --load-extensions=pylint.extensions.docparams
The old name is still kept for backward compatibility, but it will be
eventually removed.
Removed features
================
* None yet
.. _isort: https://pypi.python.org/pypi/isort
|