Debian Codegraph @

doc/whatsnew/2/2.12/full.rst

raw
1 Full changelog
2 ==============
3
4 What's New in Pylint 2.12.2?
5 ----------------------------
6 Release date: 2021-11-25
7
8 * Fixed a false positive for ``unused-import`` where everything
9 was not analyzed properly inside typing guards.
10
11 * Fixed a false-positive regression for ``used-before-assignment`` for
12 typed variables in the body of class methods that reference the same class
13
14 Closes #5342
15
16 * Specified that the ``ignore-paths`` option considers "\" to represent a
17 windows directory delimiter instead of a regular expression escape
18 character.
19
20 * Fixed a crash with the ``ignore-paths`` option when invoking the option
21 via the command line.
22
23 Closes #5437
24
25 * Fixed handling of Sphinx-style parameter docstrings with asterisks. These
26 should be escaped with by prepending a "\".
27
28 Closes #5406
29
30 * Add ``endLine`` and ``endColumn`` keys to output of ``JSONReporter``.
31
32 Closes #5380
33
34 * Fixed handling of Google-style parameter specifications where descriptions
35 are on the line following the parameter name. These were generating
36 false positives for ``missing-param-doc``.
37
38 Closes #5452
39
40 * Fix false negative for ``consider-iterating-dictionary`` during membership checks encapsulated in iterables
41 or ``not in`` checks
42
43 Closes #5323
44
45 * ``unused-import`` now check all ancestors for typing guards
46
47 Closes #5316
48
49
50 What's New in Pylint 2.12.1?
51 ----------------------------
52 Release date: 2021-11-25
53
54 * Require Python ``3.6.2`` to run pylint.
55
56 Closes #5065
57
58
59 What's New in Pylint 2.12.0?
60 ----------------------------
61 Release date: 2021-11-24
62
63 * Upgrade astroid to 2.9.0
64
65 Closes #4982
66
67 * Add ability to add ``end_line`` and ``end_column`` to the ``--msg-template`` option.
68 With the standard ``TextReporter`` this will add the line and column number of the
69 end of a node to the output of Pylint. If these numbers are unknown, they are represented
70 by an empty string.
71
72 * Introduced primer tests and a configuration tests framework. The helper classes available in
73 ``pylint/testutil/`` are still unstable and might be modified in the near future.
74
75 Closes #4412 #5287
76
77 * Fix ``install graphiz`` message which isn't needed for puml output format.
78
79 * ``MessageTest`` of the unittest ``testutil`` now requires the ``confidence`` attribute
80 to match the expected value. If none is provided it is set to ``UNDEFINED``.
81
82 * ``add_message`` of the unittest ``testutil`` now actually handles the ``col_offset`` parameter
83 and allows it to be checked against actual output in a test.
84
85 * Fix a crash in the ``check_elif`` extensions where an undetected if in a comprehension
86 with an if statement within an f-string resulted in an out of range error. The checker no
87 longer relies on counting if statements anymore and uses known if statements locations instead.
88 It should not crash on badly parsed if statements anymore.
89
90 * Fix ``simplify-boolean-expression`` when condition can be inferred as False.
91
92 Closes #5200
93
94 * Fix exception when pyreverse parses ``property function`` of a class.
95
96 * The functional ``testutils`` now accept ``end_lineno`` and ``end_column``. Expected
97 output files without these will trigger a ``DeprecationWarning``. Expected output files
98 can be easily updated with the ``python tests/test_functional.py --update-functional-output`` command.
99
100 * The functional ``testutils`` now correctly check the distinction between ``HIGH`` and
101 ``UNDEFINED`` confidence. Expected output files without defined ``confidence`` levels will now
102 trigger a ``DeprecationWarning``. Expected output files can be easily updated with the
103 ``python tests/test_functional.py --update-functional-output`` command.
104
105 * The functional test runner now supports the option ``min_pyver_end_position`` to control on which python
106 versions the ``end_lineno`` and ``end_column`` attributes should be checked. The default value is 3.8.
107
108 * Fix ``accept-no-yields-doc`` and ``accept-no-return-doc`` not allowing missing ``yield`` or
109 ``return`` documentation when a docstring is partially correct
110
111 Closes #5223
112
113 * Add an optional extension ``consider-using-any-or-all`` : Emitted when a ``for`` loop only
114 produces a boolean and could be replaced by ``any`` or ``all`` using a generator. Also suggests
115 a suitable any or all statement.
116
117 Closes #5008
118
119 * Properly identify parameters with no documentation and add new message called ``missing-any-param-doc``
120
121 Closes #3799
122
123 * Add checkers ``overridden-final-method`` & ``subclassed-final-class``
124
125 Closes #3197
126
127 * Fixed ``protected-access`` for accessing of attributes and methods of inner classes
128
129 Closes #3066
130
131 * Added support for ``ModuleNotFoundError`` (``import-error`` and ``no-name-in-module``).
132 ``ModuleNotFoundError`` inherits from ``ImportError`` and was added in Python ``3.6``
133
134 * ``undefined-variable`` now correctly flags variables which only receive a type annotations
135 and never get assigned a value
136
137 Closes #5140
138
139 * ``undefined-variable`` now correctly considers the line numbering and order of classes
140 used in metaclass declarations
141
142 Closes #4031
143
144 * ``used-before-assignment`` now correctly considers references to classes as type annotation
145 or default values in first-level methods
146
147 Closes #3771
148
149 * ``undefined-variable`` and ``unused-variable`` now correctly trigger for assignment expressions
150 in functions defaults
151
152 Refs #3688
153
154 * ``undefined-variable`` now correctly triggers for assignment expressions in if ... else statements
155 This includes a basic form of control flow inference for if ... else statements using
156 constant boolean values
157
158 Closes #3688
159
160 * Added the ``--enable-all-extensions`` command line option. It will load all available extensions
161 which can be listed by running ``--list-extensions``
162
163 * Fix bug with importing namespace packages with relative imports
164
165 Closes #2967 and #5131
166
167 * Improve and flatten ``unused-wildcard-import`` message
168
169 Closes #3859
170
171 * In length checker, ``len-as-condition`` has been renamed as
172 ``use-implicit-booleaness-not-len`` in order to be consistent with
173 ``use-implicit-booleaness-not-comparison``.
174
175 * Created new ``UnsupportedVersionChecker`` checker class that includes checks for features
176 not supported by all versions indicated by a ``py-version``.
177
178 * Added ``using-f-string-in-unsupported-version`` checker. Issued when ``py-version``
179 is set to a version that does not support f-strings (< 3.6)
180
181 * Fix ``useless-super-delegation`` false positive when default keyword argument is a variable.
182
183 * Properly emit ``duplicate-key`` when Enum members are duplicate dictionary keys
184
185 Closes #5150
186
187 * Use ``py-version`` setting for alternative union syntax check (PEP 604),
188 instead of the Python interpreter version.
189
190 * Subclasses of ``dict`` are regarded as reversible by the ``bad-reversed-sequence`` checker
191 (Python 3.8 onwards).
192
193 Closes #4981
194
195 * Support configuring mixin class pattern via ``mixin-class-rgx``
196
197 * Added new checker ``use-implicit-booleaness-not-comparison``: Emitted when
198 collection literal comparison is being used to check for emptiness.
199
200 Closes #4774
201
202 * ``missing-param-doc`` now correctly parses asterisks for variable length and
203 keyword parameters
204
205 Closes #3733
206
207 * ``missing-param-doc`` now correctly handles Numpy parameter documentation without
208 explicit typing
209
210 Closes #5222
211
212 * ``pylint`` no longer crashes when checking assignment expressions within if-statements
213
214 Closes #5178
215
216 * Update ``literal-comparison``` checker to ignore tuple literals
217
218 Closes #3031
219
220 * Normalize the input to the ``ignore-paths`` option to allow both Posix and
221 Windows paths
222
223 Closes #5194
224
225 * Fix double emitting of ``not-callable`` on inferable ``properties``
226
227 Closes #4426
228
229 * ``self-cls-assignment`` now also considers tuple assignment
230
231 * Fix ``missing-function-docstring`` not being able to check ``__init__`` and other
232 magic methods even if the ``no-docstring-rgx`` setting was set to do so
233
234 * Added ``using-final-decorator-in-unsupported-version`` checker. Issued when ``py-version``
235 is set to a version that does not support ``typing.final`` (< 3.8)
236
237 * Added configuration option ``exclude-too-few-public-methods`` to allow excluding
238 classes from the ``min-public-methods`` checker.
239
240 Closes #3370
241
242 * The ``--jobs`` parameter now fallbacks to 1 if the host operating system does not
243 have functioning shared semaphore implementation.
244
245 Closes #5216
246
247 * Fix crash for ``unused-private-member`` when checking private members on ``__class__``
248
249 Closes #5261
250
251 * Crashes when a list is encountered in a toml configuration do not happen anymore.
252
253 Closes #4580
254
255 * Moved ``misplaced-comparison-constant`` to its own extension ``comparison_placement``.
256 This checker was opinionated and now no longer a default. It can be reactived by adding
257 ``pylint.extensions.comparison_placement`` to ``load-plugins`` in your config.
258
259 Closes #1064
260
261 * A new ``bad-configuration-section`` checker was added that will emit for misplaced option
262 in pylint's top level namespace for toml configuration. Top-level dictionaries or option defined
263 in the wrong section will still silently not be taken into account, which is tracked in a
264 follow-up issue.
265
266 Follow-up in #5259
267
268 * Fix crash for ``protected-access`` on (outer) class traversal
269
270 * Added new checker ``useless-with-lock`` to find incorrect usage of with statement and threading module locks.
271 Emitted when ``with threading.Lock():`` is used instead of ``with lock_instance:``.
272
273 Closes #5208
274
275 * Make yn validator case insensitive, to allow for ``True`` and ``False`` in config files.
276
277 * Fix crash on ``open()`` calls when the ``mode`` argument is not a simple string.
278
279 Fixes part of #5321
280
281 * Inheriting from a class that implements ``__class_getitem__`` no longer raises ``inherit-non-class``.
282
283 * Pyreverse - Add the project root directory to sys.path
284
285 Closes #2479
286
287 * Don't emit ``consider-using-f-string`` if ``py-version`` is set to Python < ``3.6``.
288 ``f-strings`` were added in Python ``3.6``
289
290 Closes #5019
291
292 * Fix regression for ``unspecified-encoding`` with ``pathlib.Path.read_text()``
293
294 Closes #5029
295
296 * Don't emit ``consider-using-f-string`` if the variables to be interpolated include a backslash
297
298 * Fixed false positive for ``cell-var-from-loop`` when variable is used as the default
299 value for a keyword-only parameter.
300
301 Closes #5012
302
303 * Fix false-positive ``undefined-variable`` with ``Lambda``, ``IfExp``, and
304 assignment expression.
305
306 * Fix false-positive ``useless-suppression`` for ``wrong-import-order``
307
308 Closes #2366
309
310 * Fixed ``toml`` dependency issue
311
312 Closes #5066
313
314 * Fix false-positive ``useless-suppression`` for ``line-too-long``
315
316 Closes #4212
317
318 * Fixed ``invalid-name`` not checking parameters of overwritten base ``object`` methods
319
320 Closes #3614
321
322 * Fixed crash in ``consider-using-f-string`` if ``format`` is not called
323
324 Closes #5058
325
326 * Fix crash with ``AssignAttr`` in ``if TYPE_CHECKING`` blocks.
327
328 Closes #5111
329
330 * Improve node information for ``invalid-name`` on function argument.
331
332 * Prevent return type checkers being called on functions with ellipses as body
333
334 Closes #4736
335
336 * Add ``is_sys_guard`` and ``is_typing_guard`` helper functions from astroid
337 to ``pylint.checkers.utils``.
338
339 * Fix regression on ClassDef inference
340
341 Closes #5030
342 Closes #5036
343
344 * Fix regression on Compare node inference
345
346 Closes #5048
347
348 * Fix false-positive ``isinstance-second-argument-not-valid-type`` with ``typing.Callable``.
349
350 Closes #3507
351 Closes #5087
352
353 * It is now recommended to do ``pylint`` development on ``Python`` 3.8 or higher. This
354 allows using the latest ``ast`` parser.
355
356 * All standard jobs in the ``pylint`` CI now run on ``Python`` 3.8 by default. We still
357 support python 3.6 and 3.7 and run tests for those interpreters.
358
359 * ``TypingChecker``
360
361 * Fix false-negative for ``deprecated-typing-alias`` and ``consider-using-alias``
362 with ``typing.Type`` + ``typing.Callable``.