Debian Codegraph @

doc/whatsnew/2/2.0/full.rst

raw
1 Full changelog
2 ==============
3
4 What's New in Pylint 2.0?
5 -------------------------
6
7 Release date: 2018-07-15
8
9 * ``try-except-raise`` should not be emitted if there are any parent exception class handlers.
10
11 Closes #2284
12
13 * ``trailing-comma-tuple`` can be emitted for ``return`` statements as well.
14
15 Closes #2269
16
17 * Fix a false positive ``inconsistent-return-statements`` message when exception is raised
18 inside an else statement.
19
20 Closes #1782
21
22 * ``ImportFrom`` nodes correctly use the full name for the import sorting checks.
23
24 Closes #2181
25
26 * [].extend and similar builtin operations don't emit `dict-*-not-iterating` with the Python 3 porting checker
27
28 Closes #2187
29
30 * Add a check ``consider-using-dict-comprehension`` which is emitted if for dict initialization
31 the old style with list comprehensions is used.
32
33 * Add a check ``consider-using-set-comprehension`` which is emitted if for set initialization
34 the old style with list comprehensions is used.
35
36 * ``logging-not-lazy`` is emitted whenever pylint infers that a string is built with addition
37
38 Closes #2193
39
40 * Add a check ``chained-comparison`` which is emitted if a boolean operation can be simplified
41 by chaining some of its operations.
42 e.g "a < b and b < c", can be simplified as "a < b < c".
43
44 Closes #2032
45
46 * Add a check ``consider-using-in`` for comparisons of a variable against
47 multiple values with "==" and "or"s instead of checking if the variable
48 is contained "in" a tuple of those values.
49
50 * ``in`` is considered iterating context for some of the Python 3 porting checkers
51
52 Closes #2186
53
54 * Add ``--ignore-none`` flag to control if pylint should warn about ``no-member`` where the owner is None
55
56 * Fix a false positive related to ``too-many-arguments`` and bounded ``__get__`` methods
57
58 Closes #2172
59
60 * ``mcs`` as the first parameter of metaclass's ``__new__`` method was replaced by ``cls``
61
62 Closes #2028
63
64 * ``assignment-from-no-return`` considers methods as well.
65
66 Closes #2081
67
68 * Support typing.TYPE_CHECKING for *:ref:`unused-import`* errors
69
70 Closes #1948
71
72 * Inferred classes at a function level no longer emit ``invalid-name``
73 when they don't respect the variable regular expression
74
75 Closes #1049
76
77 * Added basic support for postponed evaluation of function annotations.
78
79 Closes #2069
80
81 * Fix a bug with ``missing-kwoa`` and variadics parameters
82
83 Closes #1111
84
85 * ``simplifiable-if-statement`` takes in account only when assigning to same targets
86
87 Closes #1984
88
89 * Make ``len-as-condition`` test more cases, such as ``len() < 1`` or ``len <= 0``
90
91 * Fix false-positive ``line-too-long`` message emission for
92 commented line at the end of a module
93
94 Closes #1950
95
96 * Fix false-positive ``bad-continuation`` for with statements
97
98 Closes #461
99
100 * Don't warn about ``stop-iteration-return`` when using ``next()`` over ``itertools.count``
101
102 Closes #2158
103
104 * Add a check ``consider-using-get`` for unidiomatic usage of value/default-retrieval
105 for a key from a dictionary
106
107 Closes #2076
108
109 * :ref:`invalid-slice-index` is not emitted when the slice is used as index for a complex object.
110
111 We only use a handful of known objects (list, set and friends) to figure out if
112 we should emit :ref:`invalid-slice-index` when the slice is used to subscript an object.
113
114 * Don't emit ``unused-import`` anymore for typing imports used in type comments.
115
116 * Add a new check :ref:`useless-import-alias`'.
117
118 Closes #2052
119
120 * Add ``comparison-with-callable`` to warn for comparison with bare callable, without calling it.
121
122 Closes #2082
123
124 * Don't warn for ``missing-type-doc`` and/or ``missing-return-type-doc``, if type
125 annotations exist on the function signature for a parameter and/or return type.
126
127 Closes #2083
128
129 * Add ``--exit-zero`` option for continuous integration scripts to more
130 easily call Pylint in environments that abort when a program returns a
131 non-zero (error) status code.
132
133 Closes #2042
134
135 * Warn if the first argument of an instance/ class method gets assigned
136
137 Closes #977
138
139 * New check ``comparison-with-itself`` to check comparison between same value.
140
141 Closes #2051
142
143 * Add a new warning, :ref:`logging-fstring-interpolation`', emitted when f-string
144 is used within logging function calls.
145
146 Closes #1998
147
148 * Don't show :ref:`useless-super-delegation`' if the subclass method has different type annotations.
149
150 Closes #1923
151
152 * Add ``unhashable-dict-key`` check.
153
154 Closes #586
155
156 * Don't warn that a global variable is unused if it is defined by an import
157
158 Closes #1453
159
160 * Skip wildcard import check for ``__init__.py``.
161
162 Closes #2026
163
164 * The Python 3 porting mode can now run with Python 3 as well.
165
166 * ``too-few-public-methods`` is not emitted for dataclasses.
167
168 Closes #1793
169
170 * New verbose mode option, enabled with ``--verbose`` command line flag, to
171 display of extra non-checker-related output. It is disabled by default.
172
173 Closes #1863
174
175 * ``undefined-loop-variable`` takes in consideration non-empty iterred objects before emitting
176
177 Closes #2039
178
179 * Add support for numpydoc optional return value names.
180
181 Closes #2030
182
183 * ``singleton-comparison`` accounts for negative checks
184
185 Closes #2037
186
187 * Add a check ``consider-using-in`` for comparisons of a variable against
188 multiple values with "==" and "or"s instead of checking if the variable
189 is contained "in" a tuple of those values.
190
191 Closes #1977
192
193 * defaultdict and subclasses of dict are now handled for dict-iter-* checks
194
195 Closes #2005
196
197 * ``logging-format-interpolation`` also emits when f-strings are used instead of % syntax.
198
199 Closes #1788
200
201 * Don't trigger :ref:`misplaced-bare-raise` when the raise is in a finally clause
202
203 Closes #1924
204
205 * Add a new check, ``possibly-unused-variable``.
206
207 This is similar to ``unused-variable``, the only difference is that it is
208 emitted when we detect a locals() call in the scope of the unused variable.
209 The ``locals()`` call could potentially use the said variable, by consuming
210 all values that are present up to the point of the call. This new check
211 allows to disable this error when the user intentionally uses ``locals()``
212 to consume everything.
213
214 Closes #1909.
215
216 * ``no-else-return`` accounts for multiple cases
217
218 The check was a bit overrestrictive because we were checking for
219 return nodes in the .orelse node. At that point though the if statement
220 can be refactored to not have the orelse. This improves the detection of
221 other cases, for instance it now detects TryExcept nodes that are part of
222 the .else branch.
223
224 Closes #1852
225
226 * Added two new checks, ``invalid-envvar-value`` and ``invalid-envvar-default``.
227
228 The former is trigger whenever pylint detects that environment variable manipulation
229 functions uses a different type than strings, while the latter is emitted whenever
230 the said functions are using a default variable of different type than expected.
231
232 * Add a check ``consider-using-join`` for concatenation of strings using str.join(sequence)
233
234 Closes #1952
235
236 * Add a check ``consider-swap-variables`` for swapping variables with tuple unpacking
237
238 Closes #1922
239
240 * Add new checker ``try-except-raise`` that warns the user if an except handler block
241 has a ``raise`` statement as its first operator. The warning is shown when there is
242 a bare raise statement, effectively re-raising the exception that was caught or the
243 type of the exception being raised is the same as the one being handled.
244
245 * Don't crash on invalid strings when checking for ``logging-format-interpolation``
246
247 Closes #1944
248
249 * Exempt ``__doc__`` from triggering a ``redefined-builtin``
250
251 ``__doc__`` can be used to specify a docstring for a module without
252 passing it as a first-statement string.
253
254 * Fix false positive bad-whitespace from function arguments with default
255 values and annotations
256
257 Closes #1831
258
259 * Fix :ref:`stop-iteration-return` false positive when next builtin has a
260 default value in a generator
261
262 Closes #1830
263
264 * Fix emission of false positive ``no-member`` message for class with "private" attributes whose name is mangled.
265
266 Closes #1643
267
268 * Fixed a crash which occurred when ``Uninferable`` wasn't properly handled in ``stop-iteration-return``
269
270 Closes #1779
271
272 * Use the proper node to get the name for redefined functions (#1792)
273
274 Closes #1774
275
276 * Don't crash when encountering bare raises while checking inconsistent returns
277
278 Closes #1773
279
280 * Fix a false positive ``inconsistent-return-statements`` message when if statement is inside try/except.
281
282 Closes #1770
283
284 * Fix a false positive ``inconsistent-return-statements`` message when while loop are used.
285
286 Closes #1772
287
288 * Correct column number for whitespace conventions.
289
290 Previously the column was stuck at 0
291
292 Closes #1649
293
294 * Fix ``unused-argument`` false positives with overshadowed variable in
295 dictionary comprehension.
296
297 Closes #1731
298
299 * Fix false positive ``inconsistent-return-statements`` message when never
300 returning functions are used (i.e sys.exit for example).
301
302 Closes #1771
303
304 * Fix error when checking if function is exception, as in ``bad-exception-context``.
305
306 * Fix false positive ``inconsistent-return-statements`` message when a
307 function is defined under an if statement.
308
309 Closes #1794
310
311 * New ``useless-return`` message when function or method ends with a "return" or
312 "return None" statement and this is the only return statement in the body.
313
314 * Fix false positive ``inconsistent-return-statements`` message by
315 avoiding useless exception inference if the exception is not handled.
316
317 Closes #1794 (second part)
318
319 * Fix bad thread instantiation check when target function is provided in args.
320
321 Closes #1840
322
323 * Fixed false positive when a numpy Attributes section follows a Parameters
324 section
325
326 Closes #1867
327
328 * Fix incorrect file path when file absolute path contains multiple ``path_strip_prefix`` strings.
329
330 Closes #1120
331
332 * Fix false positive :ref:`undefined-variable` for lambda argument in class definitions
333
334 Closes #1824
335
336 * Add of a new checker that warns the user if some messages are enabled or disabled
337 by id instead of symbol.
338
339 Closes #1599
340
341 * Suppress false-positive ``not-callable`` messages from certain
342 staticmethod descriptors
343
344 Closes #1699
345
346 * Fix indentation handling with tabs
347
348 Closes #1148
349
350 * Fix false-positive ``bad-continuation`` error
351
352 Closes #638
353
354 * Fix false positive :ref:`unused-variable` in lambda default arguments
355
356 Closes #1921
357 Closes #1552
358 Closes #1099
359 Closes #210
360
361 * Updated the default report format to include paths that can be clicked on in some terminals (e.g. iTerm).
362
363 * Fix inline def behavior with ``too-many-statements`` checker
364
365 Closes #1978
366
367 * Fix ``KeyError`` raised when using docparams and NotImplementedError is documented.
368
369 Closes #2102
370
371 * Fix :ref:`method-hidden`' raised when assigning to a property or data descriptor.
372
373 * Fix emitting ``useless-super-delegation`` when changing the default value of keyword arguments.
374
375 Closes #2022
376
377 * Expand ignored-argument-names include starred arguments and keyword arguments
378
379 Closes #2214
380
381 * Fix false-positive :ref:`undefined-variable` in nested lambda
382
383 Closes #760
384
385 * Fix false-positive ``bad-whitespace`` message for typing annoatations
386 with ellipses in them
387
388 Close 1992
389
390 * Broke down "missing-docstrings" between "module", "class" and "function"
391
392 For this to work we had to make multiple messages with the same old name
393 possible.
394
395 Closes #1164