diff options
Diffstat (limited to 'doc')
285 files changed, 995 insertions, 719 deletions
diff --git a/doc/conf.py b/doc/conf.py index 76968ec36..0da6091cc 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations @@ -109,7 +109,8 @@ master_doc = "index" # General information about the project. project = "Pylint" current_year = datetime.utcnow().year -copyright = f"2003-{current_year}, Logilab, PyCQA and contributors" # pylint: disable=redefined-builtin +contributors = "Logilab and Pylint contributors" +copyright = f"2003-{current_year}, {contributors}" # pylint: disable=redefined-builtin # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -249,7 +250,7 @@ latex_documents = [ "index", "Pylint.tex", "Pylint Documentation", - "Logilab, PyCQA and contributors", + contributors, "manual", ) ] @@ -282,9 +283,7 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ("index", "pylint", "Pylint Documentation", ["Logilab, PyCQA and contributors"], 1) -] +man_pages = [("index", "pylint", "Pylint Documentation", [contributors], 1)] # pylint: disable-next=consider-using-namedtuple-or-dataclass intersphinx_mapping = { @@ -297,7 +296,9 @@ intersphinx_mapping = { autosectionlabel_prefix_document = True # Permit duplicated titles in the resulting document. -# See https://github.com/PyCQA/pylint/issues/7362#issuecomment-1256932866 +# See https://github.com/pylint-dev/pylint/issues/7362#issuecomment-1256932866 autosectionlabel_maxdepth = 2 -linkcheck_ignore = ["https://github.com/PyCQA/pylint/blob/main/pylint/extensions/.*"] +linkcheck_ignore = [ + "https://github.com/pylint-dev/pylint/blob/main/pylint/extensions/.*" +] diff --git a/doc/contact.rst b/doc/contact.rst index 5c3920dfc..cd3594f39 100644 --- a/doc/contact.rst +++ b/doc/contact.rst @@ -9,12 +9,12 @@ You think you have found a bug in Pylint? Well, this may be the case since Pylint and Python are under heavy development! Please take the time to check if it is already in the issue tracker at -https://github.com/PyCQA/pylint +https://github.com/pylint-dev/pylint Note that the issue might also be reported in one of Pylint's major dependencies, astroid: -* https://github.com/PyCQA/astroid +* https://github.com/pylint-dev/astroid Discord server -------------- diff --git a/doc/data/messages/a/arguments-renamed/bad.py b/doc/data/messages/a/arguments-renamed/bad.py index 87b45a0d5..c9d785320 100644 --- a/doc/data/messages/a/arguments-renamed/bad.py +++ b/doc/data/messages/a/arguments-renamed/bad.py @@ -2,12 +2,15 @@ class Fruit: def brew(self, ingredient_name: str): print(f"Brewing a {type(self)} with {ingredient_name}") + class Apple(Fruit): ... + class Orange(Fruit): def brew(self, flavor: str): # [arguments-renamed] print(f"Brewing an orange with {flavor}") + for fruit, ingredient_name in [[Orange(), "thyme"], [Apple(), "cinnamon"]]: fruit.brew(ingredient_name=ingredient_name) diff --git a/doc/data/messages/a/arguments-renamed/good.py b/doc/data/messages/a/arguments-renamed/good.py index 0cd1db756..de6583806 100644 --- a/doc/data/messages/a/arguments-renamed/good.py +++ b/doc/data/messages/a/arguments-renamed/good.py @@ -2,12 +2,15 @@ class Fruit: def brew(self, ingredient_name: str): print(f"Brewing a {type(self)} with {ingredient_name}") + class Apple(Fruit): ... + class Orange(Fruit): def brew(self, ingredient_name: str): print(f"Brewing an orange with {ingredient_name}") + for fruit, ingredient_name in [[Orange(), "thyme"], [Apple(), "cinnamon"]]: fruit.brew(ingredient_name=ingredient_name) diff --git a/doc/data/messages/a/assigning-non-slot/bad.py b/doc/data/messages/a/assigning-non-slot/bad.py index a1a658ba2..506ad42cd 100644 --- a/doc/data/messages/a/assigning-non-slot/bad.py +++ b/doc/data/messages/a/assigning-non-slot/bad.py @@ -1,5 +1,5 @@ class Student: - __slots__ = ('name',) + __slots__ = ("name",) def __init__(self, name, surname): self.name = name diff --git a/doc/data/messages/a/assigning-non-slot/good.py b/doc/data/messages/a/assigning-non-slot/good.py index feb5a10fa..733728618 100644 --- a/doc/data/messages/a/assigning-non-slot/good.py +++ b/doc/data/messages/a/assigning-non-slot/good.py @@ -1,5 +1,5 @@ class Student: - __slots__ = ('name', 'surname') + __slots__ = ("name", "surname") def __init__(self, name, surname): self.name = name diff --git a/doc/data/messages/b/bad-chained-comparison/bad.py b/doc/data/messages/b/bad-chained-comparison/bad.py index eeca75f13..09e3ab627 100644 --- a/doc/data/messages/b/bad-chained-comparison/bad.py +++ b/doc/data/messages/b/bad-chained-comparison/bad.py @@ -1,3 +1,5 @@ def xor_check(*, left=None, right=None): if left is None != right is None: # [bad-chained-comparison] - raise ValueError('Either both left= and right= need to be provided or none should.') + raise ValueError( + "Either both left= and right= need to be provided or none should." + ) diff --git a/doc/data/messages/b/bad-chained-comparison/good.py b/doc/data/messages/b/bad-chained-comparison/good.py index 115f4a9db..79bb64151 100644 --- a/doc/data/messages/b/bad-chained-comparison/good.py +++ b/doc/data/messages/b/bad-chained-comparison/good.py @@ -1,3 +1,5 @@ def xor_check(*, left=None, right=None): if (left is None) != (right is None): - raise ValueError('Either both left= and right= need to be provided or none should.') + raise ValueError( + "Either both left= and right= need to be provided or none should." + ) diff --git a/doc/data/messages/b/bad-classmethod-argument/bad.py b/doc/data/messages/b/bad-classmethod-argument/bad.py index 7e43001b5..b8c6d02a0 100644 --- a/doc/data/messages/b/bad-classmethod-argument/bad.py +++ b/doc/data/messages/b/bad-classmethod-argument/bad.py @@ -1,5 +1,4 @@ class Klass: - @classmethod def get_instance(self): # [bad-classmethod-argument] return self() diff --git a/doc/data/messages/b/bad-classmethod-argument/good.py b/doc/data/messages/b/bad-classmethod-argument/good.py index 3d4decea3..6097f1e36 100644 --- a/doc/data/messages/b/bad-classmethod-argument/good.py +++ b/doc/data/messages/b/bad-classmethod-argument/good.py @@ -1,5 +1,4 @@ class Klass: - @classmethod def get_instance(cls): return cls() diff --git a/doc/data/messages/b/bad-docstring-quotes/bad.py b/doc/data/messages/b/bad-docstring-quotes/bad.py index 561921db0..bd800a40c 100644 --- a/doc/data/messages/b/bad-docstring-quotes/bad.py +++ b/doc/data/messages/b/bad-docstring-quotes/bad.py @@ -1,3 +1,3 @@ def foo(): # [bad-docstring-quotes] - 'Docstring.' + "Docstring." return diff --git a/doc/data/messages/b/bad-file-encoding/bad.py b/doc/data/messages/b/bad-file-encoding/bad.py new file mode 100644 index 000000000..a4ab46ea3 --- /dev/null +++ b/doc/data/messages/b/bad-file-encoding/bad.py @@ -0,0 +1 @@ +# coding: latin_1 # [bad-file-encoding] diff --git a/doc/data/messages/b/bad-file-encoding/details.rst b/doc/data/messages/b/bad-file-encoding/details.rst deleted file mode 100644 index ab8204529..000000000 --- a/doc/data/messages/b/bad-file-encoding/details.rst +++ /dev/null @@ -1 +0,0 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/b/bad-file-encoding/good.py b/doc/data/messages/b/bad-file-encoding/good.py index c40beb573..e69de29bb 100644 --- a/doc/data/messages/b/bad-file-encoding/good.py +++ b/doc/data/messages/b/bad-file-encoding/good.py @@ -1 +0,0 @@ -# This is a placeholder for correct code for this message. diff --git a/doc/data/messages/b/bad-format-character/details.rst b/doc/data/messages/b/bad-format-character/details.rst index 25a2d3f5c..94733967b 100644 --- a/doc/data/messages/b/bad-format-character/details.rst +++ b/doc/data/messages/b/bad-format-character/details.rst @@ -1,2 +1,2 @@ This check is currently only active for "old-style" string formatting as seen in the examples. -See `Issue #6085 <https://github.com/PyCQA/pylint/issues/6085>`_ for more information. +See `Issue #6085 <https://github.com/pylint-dev/pylint/issues/6085>`_ for more information. diff --git a/doc/data/messages/b/bad-format-string/bad.py b/doc/data/messages/b/bad-format-string/bad.py index 523b8fba8..4cb811261 100644 --- a/doc/data/messages/b/bad-format-string/bad.py +++ b/doc/data/messages/b/bad-format-string/bad.py @@ -1 +1 @@ -print('{a[0] + a[1]}'.format(a=[0, 1])) # [bad-format-string] +print("{a[0] + a[1]}".format(a=[0, 1])) # [bad-format-string] diff --git a/doc/data/messages/b/bad-format-string/good.py b/doc/data/messages/b/bad-format-string/good.py index f2d8919b0..10475fd67 100644 --- a/doc/data/messages/b/bad-format-string/good.py +++ b/doc/data/messages/b/bad-format-string/good.py @@ -1 +1 @@ -print('{a[0]} + {a[1]}'.format(a=[0, 1])) +print("{a[0]} + {a[1]}".format(a=[0, 1])) diff --git a/doc/data/messages/b/bad-indentation/good.py b/doc/data/messages/b/bad-indentation/good.py index 1a1f33c11..e7ba80a56 100644 --- a/doc/data/messages/b/bad-indentation/good.py +++ b/doc/data/messages/b/bad-indentation/good.py @@ -1,2 +1,2 @@ if input(): - print('yes') + print("yes") diff --git a/doc/data/messages/b/bad-plugin-value/details.rst b/doc/data/messages/b/bad-plugin-value/details.rst index ab8204529..c1e9b976a 100644 --- a/doc/data/messages/b/bad-plugin-value/details.rst +++ b/doc/data/messages/b/bad-plugin-value/details.rst @@ -1 +1 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! +You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/b/bad-string-format-type/details.rst b/doc/data/messages/b/bad-string-format-type/details.rst index 65752275c..c60738410 100644 --- a/doc/data/messages/b/bad-string-format-type/details.rst +++ b/doc/data/messages/b/bad-string-format-type/details.rst @@ -1,2 +1,2 @@ This check is currently only active for "old-style" string formatting as seen in the examples. -See `Issue #6085 <https://github.com/PyCQA/pylint/issues/6163>`_ for more information. +See `Issue #6085 <https://github.com/pylint-dev/pylint/issues/6163>`_ for more information. diff --git a/doc/data/messages/b/bad-thread-instantiation/bad.py b/doc/data/messages/b/bad-thread-instantiation/bad.py index 580786d85..20fa72f5a 100644 --- a/doc/data/messages/b/bad-thread-instantiation/bad.py +++ b/doc/data/messages/b/bad-thread-instantiation/bad.py @@ -2,7 +2,7 @@ import threading def thread_target(n): - print(n ** 2) + print(n**2) thread = threading.Thread(lambda: None) # [bad-thread-instantiation] diff --git a/doc/data/messages/b/bad-thread-instantiation/good.py b/doc/data/messages/b/bad-thread-instantiation/good.py index 735fa4da1..0dce7c342 100644 --- a/doc/data/messages/b/bad-thread-instantiation/good.py +++ b/doc/data/messages/b/bad-thread-instantiation/good.py @@ -2,7 +2,7 @@ import threading def thread_target(n): - print(n ** 2) + print(n**2) thread = threading.Thread(target=thread_target, args=(10,)) diff --git a/doc/data/messages/c/c-extension-no-member/details.rst b/doc/data/messages/c/c-extension-no-member/details.rst index ab8204529..c1e9b976a 100644 --- a/doc/data/messages/c/c-extension-no-member/details.rst +++ b/doc/data/messages/c/c-extension-no-member/details.rst @@ -1 +1 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! +You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/c/cell-var-from-loop/bad.py b/doc/data/messages/c/cell-var-from-loop/bad.py index 9dbd43880..b31934189 100644 --- a/doc/data/messages/c/cell-var-from-loop/bad.py +++ b/doc/data/messages/c/cell-var-from-loop/bad.py @@ -1,5 +1,7 @@ def foo(numbers): for i in numbers: + def bar(): print(i) # [cell-var-from-loop] + bar() diff --git a/doc/data/messages/c/class-variable-slots-conflict/good.py b/doc/data/messages/c/class-variable-slots-conflict/good.py index b5324bff0..2428f7866 100644 --- a/doc/data/messages/c/class-variable-slots-conflict/good.py +++ b/doc/data/messages/c/class-variable-slots-conflict/good.py @@ -1,5 +1,5 @@ class Person: - __slots__ = ("_age", "name",) + __slots__ = ("_age", "name") def __init__(self, age, name): self._age = age diff --git a/doc/data/messages/c/compare-to-empty-string/bad.py b/doc/data/messages/c/compare-to-empty-string/bad.py deleted file mode 100644 index 1ab940de7..000000000 --- a/doc/data/messages/c/compare-to-empty-string/bad.py +++ /dev/null @@ -1,8 +0,0 @@ -x = "" -y = "hello" - -if x == "": # [compare-to-empty-string] - print("x is an empty string") - -if y != "": # [compare-to-empty-string] - print("y is not an empty string") diff --git a/doc/data/messages/c/compare-to-empty-string/good.py b/doc/data/messages/c/compare-to-empty-string/good.py deleted file mode 100644 index 6c4c67e36..000000000 --- a/doc/data/messages/c/compare-to-empty-string/good.py +++ /dev/null @@ -1,8 +0,0 @@ -x = "" -y = "hello" - -if not x: - print("x is an empty string") - -if y: - print("y is not an empty string") diff --git a/doc/data/messages/c/compare-to-empty-string/pylintrc b/doc/data/messages/c/compare-to-empty-string/pylintrc deleted file mode 100644 index 13b9afd7e..000000000 --- a/doc/data/messages/c/compare-to-empty-string/pylintrc +++ /dev/null @@ -1,2 +0,0 @@ -[main] -load-plugins=pylint.extensions.emptystring diff --git a/doc/data/messages/c/compare-to-zero/bad.py b/doc/data/messages/c/compare-to-zero/bad.py deleted file mode 100644 index a6b64a407..000000000 --- a/doc/data/messages/c/compare-to-zero/bad.py +++ /dev/null @@ -1,8 +0,0 @@ -x = 0 -y = 1 - -if x == 0: # [compare-to-zero] - print("x is equal to zero") - -if y != 0: # [compare-to-zero] - print("y is not equal to zero") diff --git a/doc/data/messages/c/compare-to-zero/good.py b/doc/data/messages/c/compare-to-zero/good.py deleted file mode 100644 index bea3733e2..000000000 --- a/doc/data/messages/c/compare-to-zero/good.py +++ /dev/null @@ -1,8 +0,0 @@ -x = 0 -y = 1 - -if not x: - print("x is equal to zero") - -if y: - print("y is not equal to zero") diff --git a/doc/data/messages/c/compare-to-zero/pylintrc b/doc/data/messages/c/compare-to-zero/pylintrc deleted file mode 100644 index 895291f84..000000000 --- a/doc/data/messages/c/compare-to-zero/pylintrc +++ /dev/null @@ -1,2 +0,0 @@ -[main] -load-plugins=pylint.extensions.comparetozero diff --git a/doc/data/messages/c/comparison-with-callable/bad.py b/doc/data/messages/c/comparison-with-callable/bad.py index 9dc5ecd92..1dbdad07c 100644 --- a/doc/data/messages/c/comparison-with-callable/bad.py +++ b/doc/data/messages/c/comparison-with-callable/bad.py @@ -1,6 +1,7 @@ def function_returning_a_fruit() -> str: return "orange" + def is_an_orange(fruit: str = "apple"): # apple == <function function_returning_a_fruit at 0x7f343ff0a1f0> return fruit == function_returning_a_fruit # [comparison-with-callable] diff --git a/doc/data/messages/c/comparison-with-callable/good.py b/doc/data/messages/c/comparison-with-callable/good.py index 587cf1b98..a49007128 100644 --- a/doc/data/messages/c/comparison-with-callable/good.py +++ b/doc/data/messages/c/comparison-with-callable/good.py @@ -1,6 +1,7 @@ def function_returning_a_fruit() -> str: return "orange" + def is_an_orange(fruit: str = "apple"): # apple == orange return fruit == function_returning_a_fruit() diff --git a/doc/data/messages/c/confusing-with-statement/bad.py b/doc/data/messages/c/confusing-with-statement/bad.py index d84288058..e6570a5aa 100644 --- a/doc/data/messages/c/confusing-with-statement/bad.py +++ b/doc/data/messages/c/confusing-with-statement/bad.py @@ -1,2 +1,2 @@ -with open('file.txt', 'w') as fh1, fh2: # [confusing-with-statement] +with open("file.txt", "w") as fh1, fh2: # [confusing-with-statement] pass diff --git a/doc/data/messages/c/confusing-with-statement/good.py b/doc/data/messages/c/confusing-with-statement/good.py index e8b39d500..bcedaafa6 100644 --- a/doc/data/messages/c/confusing-with-statement/good.py +++ b/doc/data/messages/c/confusing-with-statement/good.py @@ -1,3 +1,3 @@ -with open('file.txt', 'w', encoding="utf8") as fh1: - with open('file.txt', 'w', encoding="utf8") as fh2: +with open("file.txt", "w", encoding="utf8") as fh1: + with open("file.txt", "w", encoding="utf8") as fh2: pass diff --git a/doc/data/messages/c/consider-merging-isinstance/bad.py b/doc/data/messages/c/consider-merging-isinstance/bad.py index dca0ecf05..c7b059cb4 100644 --- a/doc/data/messages/c/consider-merging-isinstance/bad.py +++ b/doc/data/messages/c/consider-merging-isinstance/bad.py @@ -2,4 +2,5 @@ from typing import Any def is_number(value: Any) -> bool: - return isinstance(value, int) or isinstance(value, float) # [consider-merging-isinstance] + # +1: [consider-merging-isinstance] + return isinstance(value, int) or isinstance(value, float) diff --git a/doc/data/messages/c/consider-using-any-or-all/good.py b/doc/data/messages/c/consider-using-any-or-all/good.py index 5acf18e74..71a727e57 100644 --- a/doc/data/messages/c/consider-using-any-or-all/good.py +++ b/doc/data/messages/c/consider-using-any-or-all/good.py @@ -1,8 +1,8 @@ - def any_even(items): """Return True if the list contains any even numbers""" return any(item % 2 == 0 for item in items) + def all_even(items): """Return True if the list contains all even numbers""" return all(item % 2 == 0 for item in items) diff --git a/doc/data/messages/c/consider-using-enumerate/bad.py b/doc/data/messages/c/consider-using-enumerate/bad.py index 25d7cbf6b..0beee2ecd 100644 --- a/doc/data/messages/c/consider-using-enumerate/bad.py +++ b/doc/data/messages/c/consider-using-enumerate/bad.py @@ -1,4 +1,4 @@ -seasons = ['Spring', 'Summer', 'Fall', 'Winter'] +seasons = ["Spring", "Summer", "Fall", "Winter"] for i in range(len(seasons)): # [consider-using-enumerate] print(i, seasons[i]) diff --git a/doc/data/messages/c/consider-using-enumerate/good.py b/doc/data/messages/c/consider-using-enumerate/good.py index c52c27066..b078e48cb 100644 --- a/doc/data/messages/c/consider-using-enumerate/good.py +++ b/doc/data/messages/c/consider-using-enumerate/good.py @@ -1,4 +1,4 @@ -seasons = ['Spring', 'Summer', 'Fall', 'Winter'] +seasons = ["Spring", "Summer", "Fall", "Winter"] for i, season in enumerate(seasons): print(i, season) diff --git a/doc/data/messages/c/consider-using-f-string/good.py b/doc/data/messages/c/consider-using-f-string/good.py index eec5abf0f..f7913fa44 100644 --- a/doc/data/messages/c/consider-using-f-string/good.py +++ b/doc/data/messages/c/consider-using-f-string/good.py @@ -1,3 +1,3 @@ -menu = ('eggs', 'spam', 42.4) +menu = ("eggs", "spam", 42.4) f_string_order = f"{menu[0]} and {menu[1]}: {menu[2]:0.2f} ¤" diff --git a/doc/data/messages/c/consider-using-generator/related.rst b/doc/data/messages/c/consider-using-generator/related.rst index f380655fb..24727cf25 100644 --- a/doc/data/messages/c/consider-using-generator/related.rst +++ b/doc/data/messages/c/consider-using-generator/related.rst @@ -1,3 +1,3 @@ - `PEP 289 <https://peps.python.org/pep-0289/>`_ -- `Benchmark and discussion for any/all/list/tuple <https://github.com/PyCQA/pylint/pull/3309#discussion_r576683109>`_ -- `Benchmark and discussion for sum/max/min <https://github.com/PyCQA/pylint/pull/6595#issuecomment-1125704244>`_ +- `Benchmark and discussion for any/all/list/tuple <https://github.com/pylint-dev/pylint/pull/3309#discussion_r576683109>`_ +- `Benchmark and discussion for sum/max/min <https://github.com/pylint-dev/pylint/pull/6595#issuecomment-1125704244>`_ diff --git a/doc/data/messages/c/consider-using-in/bad.py b/doc/data/messages/c/consider-using-in/bad.py index 7199c1d82..81eddb7f3 100644 --- a/doc/data/messages/c/consider-using-in/bad.py +++ b/doc/data/messages/c/consider-using-in/bad.py @@ -1,2 +1,3 @@ def fruit_is_round(fruit): - return fruit == "apple" or fruit == "orange" or fruit == "melon" # [consider-using-in] + # +1: [consider-using-in] + return fruit == "apple" or fruit == "orange" or fruit == "melon" diff --git a/doc/data/messages/c/consider-using-join/bad.py b/doc/data/messages/c/consider-using-join/bad.py index c77b6f767..5d5a32fb7 100644 --- a/doc/data/messages/c/consider-using-join/bad.py +++ b/doc/data/messages/c/consider-using-join/bad.py @@ -4,4 +4,5 @@ def fruits_to_string(fruits): formatted_fruit += fruit # [consider-using-join] return formatted_fruit + print(fruits_to_string(["apple", "pear", "peach"])) diff --git a/doc/data/messages/c/cyclic-import/details.rst b/doc/data/messages/c/cyclic-import/details.rst index ab8204529..c1e9b976a 100644 --- a/doc/data/messages/c/cyclic-import/details.rst +++ b/doc/data/messages/c/cyclic-import/details.rst @@ -1 +1 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! +You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/d/deprecated-method/bad.py b/doc/data/messages/d/deprecated-method/bad.py index dd75a258a..78870f3c3 100644 --- a/doc/data/messages/d/deprecated-method/bad.py +++ b/doc/data/messages/d/deprecated-method/bad.py @@ -1,3 +1,3 @@ import logging -logging.warn("I'm coming, world !") # [deprecated-method] +logging.warn("I'm coming, world !") # [deprecated-method] diff --git a/doc/data/messages/d/dict-init-mutate/bad.py b/doc/data/messages/d/dict-init-mutate/bad.py index d6d1cfe18..d7db9c528 100644 --- a/doc/data/messages/d/dict-init-mutate/bad.py +++ b/doc/data/messages/d/dict-init-mutate/bad.py @@ -1,3 +1,3 @@ fruit_prices = {} # [dict-init-mutate] -fruit_prices['apple'] = 1 -fruit_prices['banana'] = 10 +fruit_prices["apple"] = 1 +fruit_prices["banana"] = 10 diff --git a/doc/data/messages/d/dict-iter-missing-items/bad.py b/doc/data/messages/d/dict-iter-missing-items/bad.py index ec9dbd924..52efa3ad7 100644 --- a/doc/data/messages/d/dict-iter-missing-items/bad.py +++ b/doc/data/messages/d/dict-iter-missing-items/bad.py @@ -1,3 +1,3 @@ -data = {'Paris': 2_165_423, 'New York City': 8_804_190, 'Tokyo': 13_988_129} +data = {"Paris": 2_165_423, "New York City": 8_804_190, "Tokyo": 13_988_129} for city, population in data: # [dict-iter-missing-items] print(f"{city} has population {population}.") diff --git a/doc/data/messages/d/dict-iter-missing-items/good.py b/doc/data/messages/d/dict-iter-missing-items/good.py index b94f125a3..3eb97f9e2 100644 --- a/doc/data/messages/d/dict-iter-missing-items/good.py +++ b/doc/data/messages/d/dict-iter-missing-items/good.py @@ -1,3 +1,3 @@ -data = {'Paris': 2_165_423, 'New York City': 8_804_190, 'Tokyo': 13_988_129} +data = {"Paris": 2_165_423, "New York City": 8_804_190, "Tokyo": 13_988_129} for city, population in data.items(): print(f"{city} has population {population}.") diff --git a/doc/data/messages/d/duplicate-code/bad/orange.py b/doc/data/messages/d/duplicate-code/bad/orange.py index faafce747..9be3c7b40 100644 --- a/doc/data/messages/d/duplicate-code/bad/orange.py +++ b/doc/data/messages/d/duplicate-code/bad/orange.py @@ -1,4 +1,4 @@ -class Orange: # [duplicate-code] +class Orange: # [duplicate-code] def __init__(self): self.remaining_bites = 3 diff --git a/doc/data/messages/d/duplicate-value/bad.py b/doc/data/messages/d/duplicate-value/bad.py index bf6f8ad00..975eebdae 100644 --- a/doc/data/messages/d/duplicate-value/bad.py +++ b/doc/data/messages/d/duplicate-value/bad.py @@ -1 +1 @@ -incorrect_set = {'value1', 23, 5, 'value1'} # [duplicate-value] +incorrect_set = {"value1", 23, 5, "value1"} # [duplicate-value] diff --git a/doc/data/messages/d/duplicate-value/good.py b/doc/data/messages/d/duplicate-value/good.py index c30cd7821..beeeb39b9 100644 --- a/doc/data/messages/d/duplicate-value/good.py +++ b/doc/data/messages/d/duplicate-value/good.py @@ -1 +1 @@ -correct_set = {'value1', 23, 5} +correct_set = {"value1", 23, 5} diff --git a/doc/data/messages/e/exec-used/good.py b/doc/data/messages/e/exec-used/good.py index ef9b17f3f..f3e1dd7b7 100644 --- a/doc/data/messages/e/exec-used/good.py +++ b/doc/data/messages/e/exec-used/good.py @@ -1,8 +1,9 @@ def get_user_code(name): - return input(f'Enter code to be executed please, {name}: ') + return input(f"Enter code to be executed please, {name}: ") username = "Ada" -allowed_globals = {'__builtins__' : None} -allowed_locals = {'print': print} -exec(get_user_code(username), allowed_globals, allowed_locals) # pylint: disable=exec-used +allowed_globals = {"__builtins__": None} +allowed_locals = {"print": print} +# pylint: disable-next=exec-used +exec(get_user_code(username), allowed_globals, allowed_locals) diff --git a/doc/data/messages/f/fixme/details.rst b/doc/data/messages/f/fixme/details.rst index 02869b537..732b4d88d 100644 --- a/doc/data/messages/f/fixme/details.rst +++ b/doc/data/messages/f/fixme/details.rst @@ -1,2 +1,2 @@ You can get use regular expressions and the ``notes-rgx`` option to create some constraints for this message. -See `the following issue <https://github.com/PyCQA/pylint/issues/2874>`_ for some examples. +See `the following issue <https://github.com/pylint-dev/pylint/issues/2874>`_ for some examples. diff --git a/doc/data/messages/f/forgotten-debug-statement/bad.py b/doc/data/messages/f/forgotten-debug-statement/bad.py index 6a2a34580..e37185371 100644 --- a/doc/data/messages/f/forgotten-debug-statement/bad.py +++ b/doc/data/messages/f/forgotten-debug-statement/bad.py @@ -3,10 +3,15 @@ import pdb def find_the_treasure(clues): for clue in clues: - pdb.set_trace() # [forgotten-debug-statement] + pdb.set_trace() # [forgotten-debug-statement] if "treasure" in clue: return True return False -treasure_hunt = ["Dead Man's Chest", "X marks the spot", "The treasure is buried near the palm tree"] + +treasure_hunt = [ + "Dead Man's Chest", + "X marks the spot", + "The treasure is buried near the palm tree", +] find_the_treasure(treasure_hunt) diff --git a/doc/data/messages/f/forgotten-debug-statement/good.py b/doc/data/messages/f/forgotten-debug-statement/good.py index 21132cb47..7896ff50e 100644 --- a/doc/data/messages/f/forgotten-debug-statement/good.py +++ b/doc/data/messages/f/forgotten-debug-statement/good.py @@ -4,5 +4,10 @@ def find_the_treasure(clues): return True return False -treasure_hunt = ["Dead Man's Chest", "X marks the spot", "The treasure is buried near the palm tree"] + +treasure_hunt = [ + "Dead Man's Chest", + "X marks the spot", + "The treasure is buried near the palm tree", +] find_the_treasure(treasure_hunt) diff --git a/doc/data/messages/f/format-combined-specification/bad.py b/doc/data/messages/f/format-combined-specification/bad.py index 6a6a051f2..f530aa0d5 100644 --- a/doc/data/messages/f/format-combined-specification/bad.py +++ b/doc/data/messages/f/format-combined-specification/bad.py @@ -1 +1 @@ -print('{} {1}'.format('hello', 'world')) # [format-combined-specification] +print("{} {1}".format("hello", "world")) # [format-combined-specification] diff --git a/doc/data/messages/f/format-combined-specification/good.py b/doc/data/messages/f/format-combined-specification/good.py index 542b77507..8aaab67f2 100644 --- a/doc/data/messages/f/format-combined-specification/good.py +++ b/doc/data/messages/f/format-combined-specification/good.py @@ -1,3 +1,3 @@ -print('{0} {1}'.format('hello', 'world')) +print("{0} {1}".format("hello", "world")) # or -print('{} {}'.format('hello', 'world')) +print("{} {}".format("hello", "world")) diff --git a/doc/data/messages/i/implicit-str-concat/details.rst b/doc/data/messages/i/implicit-str-concat/details.rst new file mode 100644 index 000000000..f09d48110 --- /dev/null +++ b/doc/data/messages/i/implicit-str-concat/details.rst @@ -0,0 +1,26 @@ +By default, detection of implicit string concatenation of line jumps is disabled. +Hence the following code will not trigger this rule: + +.. code-block:: python + + SEQ = ('a', 'b' + 'c') + +In order to detect this case, you must enable `check-str-concat-over-line-jumps`: + +.. code-block:: toml + + [STRING_CONSTANT] + check-str-concat-over-line-jumps = yes + +However, the drawback of this setting is that it will trigger false positive +for string parameters passed on multiple lines in function calls: + +.. code-block:: python + + warnings.warn( + "rotate() is deprecated and will be removed in a future release. " + "Use the rotation() context manager instead.", + DeprecationWarning, + stacklevel=3, + ) diff --git a/doc/data/messages/i/implicit-str-concat/related.rst b/doc/data/messages/i/implicit-str-concat/related.rst new file mode 100644 index 000000000..90d29dbdf --- /dev/null +++ b/doc/data/messages/i/implicit-str-concat/related.rst @@ -0,0 +1 @@ +- `Allowing parenthesized implicitly concatenated strings, to be more compatible with black <https://github.com/pylint-dev/pylint/pull/8590>`_ diff --git a/doc/data/messages/i/import-outside-toplevel/bad.py b/doc/data/messages/i/import-outside-toplevel/bad.py index 54db8840d..5262ba770 100644 --- a/doc/data/messages/i/import-outside-toplevel/bad.py +++ b/doc/data/messages/i/import-outside-toplevel/bad.py @@ -1,3 +1,4 @@ def print_python_version(): import sys # [import-outside-toplevel] + print(sys.version_info) diff --git a/doc/data/messages/i/import-private-name/bad.py b/doc/data/messages/i/import-private-name/bad.py index 96a2a9fc9..e562e4928 100644 --- a/doc/data/messages/i/import-private-name/bad.py +++ b/doc/data/messages/i/import-private-name/bad.py @@ -2,6 +2,7 @@ from argparse import _AttributeHolder, _SubParsersAction # [import-private-name attr_holder = _AttributeHolder() + def add_sub_parser(sub_parsers: _SubParsersAction): - sub_parsers.add_parser('my_subparser') + sub_parsers.add_parser("my_subparser") # ... diff --git a/doc/data/messages/i/import-private-name/good.py b/doc/data/messages/i/import-private-name/good.py index 3a5599cfb..810005fea 100644 --- a/doc/data/messages/i/import-private-name/good.py +++ b/doc/data/messages/i/import-private-name/good.py @@ -4,5 +4,5 @@ from argparse import _SubParsersAction def add_sub_parser(sub_parsers: _SubParsersAction): - sub_parsers.add_parser('my_subparser') + sub_parsers.add_parser("my_subparser") # ... diff --git a/doc/data/messages/i/init-is-generator/bad.py b/doc/data/messages/i/init-is-generator/bad.py index 37c204ab2..415b94c4d 100644 --- a/doc/data/messages/i/init-is-generator/bad.py +++ b/doc/data/messages/i/init-is-generator/bad.py @@ -2,4 +2,5 @@ class Fruit: def __init__(self, worms): # [init-is-generator] yield from worms + apple = Fruit(["Fahad", "Anisha", "Tabatha"]) diff --git a/doc/data/messages/i/init-is-generator/good.py b/doc/data/messages/i/init-is-generator/good.py index 483cd46c1..1f5bf0047 100644 --- a/doc/data/messages/i/init-is-generator/good.py +++ b/doc/data/messages/i/init-is-generator/good.py @@ -5,6 +5,7 @@ class Fruit: def worms(self): yield from self.__worms + apple = Fruit(["Fahad", "Anisha", "Tabatha"]) for worm in apple.worms(): pass diff --git a/doc/data/messages/i/invalid-all-format/bad.py b/doc/data/messages/i/invalid-all-format/bad.py index 9559869a9..c89137734 100644 --- a/doc/data/messages/i/invalid-all-format/bad.py +++ b/doc/data/messages/i/invalid-all-format/bad.py @@ -1,3 +1,3 @@ -__all__ = ("CONST") # [invalid-all-format] +__all__ = "CONST" # [invalid-all-format] CONST = 42 diff --git a/doc/data/messages/i/invalid-all-object/bad.py b/doc/data/messages/i/invalid-all-object/bad.py index 74cf738dc..04509727b 100644 --- a/doc/data/messages/i/invalid-all-object/bad.py +++ b/doc/data/messages/i/invalid-all-object/bad.py @@ -4,8 +4,10 @@ __all__ = ( Worm, ) + class Fruit: pass + class Worm: pass diff --git a/doc/data/messages/i/invalid-all-object/good.py b/doc/data/messages/i/invalid-all-object/good.py index db5879cf3..351cfa1c6 100644 --- a/doc/data/messages/i/invalid-all-object/good.py +++ b/doc/data/messages/i/invalid-all-object/good.py @@ -1,7 +1,9 @@ -__all__ = ['Fruit', 'Worm'] +__all__ = ["Fruit", "Worm"] + class Fruit: pass + class Worm: pass diff --git a/doc/data/messages/i/invalid-character-backspace/bad.py b/doc/data/messages/i/invalid-character-backspace/bad.py index a41d6b2bc..ac9ed67a3 100644 --- a/doc/data/messages/i/invalid-character-backspace/bad.py +++ b/doc/data/messages/i/invalid-character-backspace/bad.py @@ -1 +1 @@ -STRING = "Invalid character backspace " # [invalid-character-backspace] +STRING = "Invalid character backspace " # [invalid-character-backspace] diff --git a/doc/data/messages/i/invalid-character-carriage-return/details.rst b/doc/data/messages/i/invalid-character-carriage-return/details.rst index ab8204529..c1e9b976a 100644 --- a/doc/data/messages/i/invalid-character-carriage-return/details.rst +++ b/doc/data/messages/i/invalid-character-carriage-return/details.rst @@ -1 +1 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! +You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/i/invalid-character-esc/bad.py b/doc/data/messages/i/invalid-character-esc/bad.py index 24c6a79ea..0d50cab42 100644 --- a/doc/data/messages/i/invalid-character-esc/bad.py +++ b/doc/data/messages/i/invalid-character-esc/bad.py @@ -1 +1 @@ -STRING = "Invalid escape character " # [invalid-character-esc] +STRING = "Invalid escape character " # [invalid-character-esc] diff --git a/doc/data/messages/i/invalid-character-nul/details.rst b/doc/data/messages/i/invalid-character-nul/details.rst index ab8204529..c1e9b976a 100644 --- a/doc/data/messages/i/invalid-character-nul/details.rst +++ b/doc/data/messages/i/invalid-character-nul/details.rst @@ -1 +1 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! +You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/i/invalid-character-sub/bad.py b/doc/data/messages/i/invalid-character-sub/bad.py index 96f8c06fe..313066d3b 100644 --- a/doc/data/messages/i/invalid-character-sub/bad.py +++ b/doc/data/messages/i/invalid-character-sub/bad.py @@ -1 +1 @@ -STRING = "Invalid character sub " # [invalid-character-sub] +STRING = "Invalid character sub " # [invalid-character-sub] diff --git a/doc/data/messages/i/invalid-character-zero-width-space/bad.py b/doc/data/messages/i/invalid-character-zero-width-space/bad.py index 1854893b4..99160fc8f 100644 --- a/doc/data/messages/i/invalid-character-zero-width-space/bad.py +++ b/doc/data/messages/i/invalid-character-zero-width-space/bad.py @@ -1 +1 @@ -STRING = "Invalid character zero-width-space ​" # [invalid-character-zero-width-space] +STRING = "Invalid character zero-width-space ​" # [invalid-character-zero-width-space] diff --git a/doc/data/messages/i/invalid-envvar-default/bad.py b/doc/data/messages/i/invalid-envvar-default/bad.py index 8d66765ee..9b564b9c8 100644 --- a/doc/data/messages/i/invalid-envvar-default/bad.py +++ b/doc/data/messages/i/invalid-envvar-default/bad.py @@ -1,3 +1,3 @@ import os -env = os.getenv('SECRET_KEY', 1) # [invalid-envvar-default] +env = os.getenv("SECRET_KEY", 1) # [invalid-envvar-default] diff --git a/doc/data/messages/i/invalid-envvar-default/good.py b/doc/data/messages/i/invalid-envvar-default/good.py index 67656d04a..103925941 100644 --- a/doc/data/messages/i/invalid-envvar-default/good.py +++ b/doc/data/messages/i/invalid-envvar-default/good.py @@ -1,3 +1,3 @@ import os -env = os.getenv('SECRET_KEY', '1') +env = os.getenv("SECRET_KEY", "1") diff --git a/doc/data/messages/i/invalid-envvar-value/good.py b/doc/data/messages/i/invalid-envvar-value/good.py index 0b510db39..fd082ecfd 100644 --- a/doc/data/messages/i/invalid-envvar-value/good.py +++ b/doc/data/messages/i/invalid-envvar-value/good.py @@ -1,3 +1,3 @@ import os -os.getenv('1') +os.getenv("1") diff --git a/doc/data/messages/i/invalid-format-index/good.py b/doc/data/messages/i/invalid-format-index/good.py index 37129745b..69557980b 100644 --- a/doc/data/messages/i/invalid-format-index/good.py +++ b/doc/data/messages/i/invalid-format-index/good.py @@ -1,2 +1,2 @@ enough_fruits = ["apple", "banana"] -print('The second fruit is a {fruits[1]}'.format(fruits=enough_fruits)) +print("The second fruit is a {fruits[1]}".format(fruits=enough_fruits)) diff --git a/doc/data/messages/i/invalid-length-returned/bad.py b/doc/data/messages/i/invalid-length-returned/bad.py index 0dcac176c..2ae1396c3 100644 --- a/doc/data/messages/i/invalid-length-returned/bad.py +++ b/doc/data/messages/i/invalid-length-returned/bad.py @@ -3,4 +3,4 @@ class FruitBasket: self.fruits = ["Apple", "Banana", "Orange"] def __len__(self): # [invalid-length-returned] - return - len(self.fruits) + return -len(self.fruits) diff --git a/doc/data/messages/i/invalid-metaclass/good.py b/doc/data/messages/i/invalid-metaclass/good.py index e8b90fc01..07c907f10 100644 --- a/doc/data/messages/i/invalid-metaclass/good.py +++ b/doc/data/messages/i/invalid-metaclass/good.py @@ -1,5 +1,6 @@ class Plant: pass + class Apple(Plant): pass diff --git a/doc/data/messages/i/invalid-name/bad.py b/doc/data/messages/i/invalid-name/bad.py index fac9b4947..b40ee4746 100644 --- a/doc/data/messages/i/invalid-name/bad.py +++ b/doc/data/messages/i/invalid-name/bad.py @@ -1,5 +1,4 @@ class cat: # [invalid-name] - def Meow(self, NUMBER_OF_MEOW): # [invalid-name, invalid-name] print("Meow" * NUMBER_OF_MEOW) return NUMBER_OF_MEOW diff --git a/doc/data/messages/i/invalid-name/good.py b/doc/data/messages/i/invalid-name/good.py index 3decdb3e4..d747a72f0 100644 --- a/doc/data/messages/i/invalid-name/good.py +++ b/doc/data/messages/i/invalid-name/good.py @@ -1,5 +1,4 @@ class Cat: - def meow(self, number_of_meow): print("Meow" * number_of_meow) return number_of_meow diff --git a/doc/data/messages/i/invalid-overridden-method/bad.py b/doc/data/messages/i/invalid-overridden-method/bad.py index 379f7c0a1..c7e250fb5 100644 --- a/doc/data/messages/i/invalid-overridden-method/bad.py +++ b/doc/data/messages/i/invalid-overridden-method/bad.py @@ -2,6 +2,7 @@ class Fruit: async def bore(self, insect): insect.eat(self) + class Apple(Fruit): def bore(self, insect): # [invalid-overridden-method] insect.eat(self) diff --git a/doc/data/messages/i/invalid-overridden-method/good.py b/doc/data/messages/i/invalid-overridden-method/good.py index f5b56308f..320663778 100644 --- a/doc/data/messages/i/invalid-overridden-method/good.py +++ b/doc/data/messages/i/invalid-overridden-method/good.py @@ -2,6 +2,7 @@ class Fruit: async def bore(self, insect): insect.eat(self) + class Apple(Fruit): async def bore(self, insect): insect.eat(self) diff --git a/doc/data/messages/i/invalid-sequence-index/bad.py b/doc/data/messages/i/invalid-sequence-index/bad.py index f153503b9..c13a3742a 100644 --- a/doc/data/messages/i/invalid-sequence-index/bad.py +++ b/doc/data/messages/i/invalid-sequence-index/bad.py @@ -1,2 +1,2 @@ -fruits = ['apple', 'banana', 'orange'] -print(fruits['apple']) # [invalid-sequence-index] +fruits = ["apple", "banana", "orange"] +print(fruits["apple"]) # [invalid-sequence-index] diff --git a/doc/data/messages/i/invalid-sequence-index/good.py b/doc/data/messages/i/invalid-sequence-index/good.py index 04bdf3ffd..840f3c3f3 100644 --- a/doc/data/messages/i/invalid-sequence-index/good.py +++ b/doc/data/messages/i/invalid-sequence-index/good.py @@ -1,2 +1,2 @@ -fruits = ['apple', 'banana', 'orange'] +fruits = ["apple", "banana", "orange"] print(fruits[0]) diff --git a/doc/data/messages/i/invalid-slots-object/bad.py b/doc/data/messages/i/invalid-slots-object/bad.py index 41baaa54f..03690cf36 100644 --- a/doc/data/messages/i/invalid-slots-object/bad.py +++ b/doc/data/messages/i/invalid-slots-object/bad.py @@ -1,2 +1,2 @@ class Person: - __slots__ = ('name', 3) # [invalid-slots-object] + __slots__ = ("name", 3) # [invalid-slots-object] diff --git a/doc/data/messages/i/invalid-slots-object/good.py b/doc/data/messages/i/invalid-slots-object/good.py index e8eec6949..823a971f1 100644 --- a/doc/data/messages/i/invalid-slots-object/good.py +++ b/doc/data/messages/i/invalid-slots-object/good.py @@ -1,2 +1,2 @@ class Person: - __slots__ = ('name', 'surname') + __slots__ = ("name", "surname") diff --git a/doc/data/messages/i/invalid-slots/good.py b/doc/data/messages/i/invalid-slots/good.py index 0cb4d1b1e..b7881356c 100644 --- a/doc/data/messages/i/invalid-slots/good.py +++ b/doc/data/messages/i/invalid-slots/good.py @@ -1,2 +1,2 @@ class Person: - __slots__ = ("name", "age",) + __slots__ = ("name", "age") diff --git a/doc/data/messages/i/invalid-star-assignment-target/bad.py b/doc/data/messages/i/invalid-star-assignment-target/bad.py index fc69dc7e6..476928560 100644 --- a/doc/data/messages/i/invalid-star-assignment-target/bad.py +++ b/doc/data/messages/i/invalid-star-assignment-target/bad.py @@ -1 +1 @@ -*fruit = ['apple', 'banana', 'orange'] # [invalid-star-assignment-target] +*fruit = ["apple", "banana", "orange"] # [invalid-star-assignment-target] diff --git a/doc/data/messages/i/invalid-star-assignment-target/good.py b/doc/data/messages/i/invalid-star-assignment-target/good.py index 74cf088e2..b174bcd20 100644 --- a/doc/data/messages/i/invalid-star-assignment-target/good.py +++ b/doc/data/messages/i/invalid-star-assignment-target/good.py @@ -1 +1 @@ -fruit = ['apple', 'banana', 'orange'] +fruit = ["apple", "banana", "orange"] diff --git a/doc/data/messages/i/invalid-unary-operand-type/bad.py b/doc/data/messages/i/invalid-unary-operand-type/bad.py index 77391c3d9..b01195194 100644 --- a/doc/data/messages/i/invalid-unary-operand-type/bad.py +++ b/doc/data/messages/i/invalid-unary-operand-type/bad.py @@ -1,3 +1,3 @@ cherries = 10 eaten_cherries = int -cherries = - eaten_cherries # [invalid-unary-operand-type] +cherries = -eaten_cherries # [invalid-unary-operand-type] diff --git a/doc/data/messages/i/invalid-unicode-codec/details.rst b/doc/data/messages/i/invalid-unicode-codec/details.rst index ab8204529..67001aca8 100644 --- a/doc/data/messages/i/invalid-unicode-codec/details.rst +++ b/doc/data/messages/i/invalid-unicode-codec/details.rst @@ -1 +1 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! +This message is a placeholder for a potential future issue with unicode codecs. diff --git a/doc/data/messages/i/invalid-unicode-codec/good.py b/doc/data/messages/i/invalid-unicode-codec/good.py deleted file mode 100644 index c40beb573..000000000 --- a/doc/data/messages/i/invalid-unicode-codec/good.py +++ /dev/null @@ -1 +0,0 @@ -# This is a placeholder for correct code for this message. diff --git a/doc/data/messages/l/line-too-long/details.rst b/doc/data/messages/l/line-too-long/details.rst index 7f774a661..3a3a03897 100644 --- a/doc/data/messages/l/line-too-long/details.rst +++ b/doc/data/messages/l/line-too-long/details.rst @@ -2,4 +2,4 @@ Pragma controls such as ``# pylint: disable=all`` are not counted toward line le If you attempt to disable this message via ``# pylint: disable=line-too-long`` in a module with no code, you may receive a message for ``useless-suppression``. This is a false positive of ``useless-suppression`` we can't easily fix. -See https://github.com/PyCQA/pylint/issues/3368 for more information. +See https://github.com/pylint-dev/pylint/issues/3368 for more information. diff --git a/doc/data/messages/l/locally-disabled/bad.py b/doc/data/messages/l/locally-disabled/bad.py index 5bfbd58f8..1a3307856 100644 --- a/doc/data/messages/l/locally-disabled/bad.py +++ b/doc/data/messages/l/locally-disabled/bad.py @@ -3,5 +3,6 @@ def wizard_spells(spell_book): for spell in spell_book: print(f"Abracadabra! {spell}.") + spell_list = ["Levitation", "Invisibility", "Fireball", "Teleportation"] wizard_spells(spell_list) diff --git a/doc/data/messages/l/locally-disabled/good.py b/doc/data/messages/l/locally-disabled/good.py index 322a78f27..1bf60bca0 100644 --- a/doc/data/messages/l/locally-disabled/good.py +++ b/doc/data/messages/l/locally-disabled/good.py @@ -2,5 +2,6 @@ def wizard_spells(spell_book): for spell in spell_book: print(f"Abracadabra! {spell}.") + spell_list = ["Levitation", "Invisibility", "Fireball", "Teleportation"] wizard_spells(spell_list) diff --git a/doc/data/messages/l/logging-format-interpolation/bad.py b/doc/data/messages/l/logging-format-interpolation/bad.py index 0cef831d2..dd828e1f9 100644 --- a/doc/data/messages/l/logging-format-interpolation/bad.py +++ b/doc/data/messages/l/logging-format-interpolation/bad.py @@ -1,4 +1,5 @@ import logging import sys -logging.error('Python version: {}'.format(sys.version)) # [logging-format-interpolation] +# +1: [logging-format-interpolation] +logging.error("Python version: {}".format(sys.version)) diff --git a/doc/data/messages/l/logging-format-interpolation/good.py b/doc/data/messages/l/logging-format-interpolation/good.py index 7f54cebfb..a993d0dd8 100644 --- a/doc/data/messages/l/logging-format-interpolation/good.py +++ b/doc/data/messages/l/logging-format-interpolation/good.py @@ -1,4 +1,4 @@ import logging import sys -logging.error('Python version: %s', sys.version) +logging.error("Python version: %s", sys.version) diff --git a/doc/data/messages/l/logging-fstring-interpolation/bad.py b/doc/data/messages/l/logging-fstring-interpolation/bad.py index dfee6d4c6..773435fb4 100644 --- a/doc/data/messages/l/logging-fstring-interpolation/bad.py +++ b/doc/data/messages/l/logging-fstring-interpolation/bad.py @@ -1,4 +1,4 @@ import logging import sys -logging.error(f'Python version: {sys.version}') # [logging-fstring-interpolation] +logging.error(f"Python version: {sys.version}") # [logging-fstring-interpolation] diff --git a/doc/data/messages/l/logging-fstring-interpolation/good.py b/doc/data/messages/l/logging-fstring-interpolation/good.py index 7f54cebfb..a993d0dd8 100644 --- a/doc/data/messages/l/logging-fstring-interpolation/good.py +++ b/doc/data/messages/l/logging-fstring-interpolation/good.py @@ -1,4 +1,4 @@ import logging import sys -logging.error('Python version: %s', sys.version) +logging.error("Python version: %s", sys.version) diff --git a/doc/data/messages/l/logging-not-lazy/bad.py b/doc/data/messages/l/logging-not-lazy/bad.py index cb6bc3d84..7ba0631db 100644 --- a/doc/data/messages/l/logging-not-lazy/bad.py +++ b/doc/data/messages/l/logging-not-lazy/bad.py @@ -3,5 +3,5 @@ import logging try: function() except Exception as e: - logging.error('Error occurred: %s' % e) # [logging-not-lazy] + logging.error("Error occurred: %s" % e) # [logging-not-lazy] raise diff --git a/doc/data/messages/l/logging-not-lazy/good.py b/doc/data/messages/l/logging-not-lazy/good.py index c61704872..ede0050cb 100644 --- a/doc/data/messages/l/logging-not-lazy/good.py +++ b/doc/data/messages/l/logging-not-lazy/good.py @@ -3,5 +3,5 @@ import logging try: function() except Exception as e: - logging.error('Error occurred: %s', e) + logging.error("Error occurred: %s", e) raise diff --git a/doc/data/messages/l/logging-too-few-args/bad.py b/doc/data/messages/l/logging-too-few-args/bad.py index 66d88d0b3..a20b83b12 100644 --- a/doc/data/messages/l/logging-too-few-args/bad.py +++ b/doc/data/messages/l/logging-too-few-args/bad.py @@ -3,5 +3,5 @@ import logging try: function() except Exception as e: - logging.error('%s error occurred: %s', e) # [logging-too-few-args] + logging.error("%s error occurred: %s", e) # [logging-too-few-args] raise diff --git a/doc/data/messages/l/logging-too-few-args/good.py b/doc/data/messages/l/logging-too-few-args/good.py index 4b34b58b9..4812aec01 100644 --- a/doc/data/messages/l/logging-too-few-args/good.py +++ b/doc/data/messages/l/logging-too-few-args/good.py @@ -3,5 +3,5 @@ import logging try: function() except Exception as e: - logging.error('%s error occurred: %s', type(e), e) + logging.error("%s error occurred: %s", type(e), e) raise diff --git a/doc/data/messages/l/logging-too-many-args/bad.py b/doc/data/messages/l/logging-too-many-args/bad.py index 45f485d93..03753f607 100644 --- a/doc/data/messages/l/logging-too-many-args/bad.py +++ b/doc/data/messages/l/logging-too-many-args/bad.py @@ -3,5 +3,5 @@ import logging try: function() except Exception as e: - logging.error('Error occurred: %s', type(e), e) # [logging-too-many-args] + logging.error("Error occurred: %s", type(e), e) # [logging-too-many-args] raise diff --git a/doc/data/messages/l/logging-too-many-args/good.py b/doc/data/messages/l/logging-too-many-args/good.py index 4b34b58b9..4812aec01 100644 --- a/doc/data/messages/l/logging-too-many-args/good.py +++ b/doc/data/messages/l/logging-too-many-args/good.py @@ -3,5 +3,5 @@ import logging try: function() except Exception as e: - logging.error('%s error occurred: %s', type(e), e) + logging.error("%s error occurred: %s", type(e), e) raise diff --git a/doc/data/messages/l/logging-unsupported-format/bad.py b/doc/data/messages/l/logging-unsupported-format/bad.py index 5b5ea5a5f..1f36a0d34 100644 --- a/doc/data/messages/l/logging-unsupported-format/bad.py +++ b/doc/data/messages/l/logging-unsupported-format/bad.py @@ -1,3 +1,3 @@ import logging -logging.info("%s %y !", "Hello", "World") # [logging-unsupported-format] +logging.info("%s %y !", "Hello", "World") # [logging-unsupported-format] diff --git a/doc/data/messages/m/magic-value-comparison/bad.py b/doc/data/messages/m/magic-value-comparison/bad.py index 536659abe..eef9e5d27 100644 --- a/doc/data/messages/m/magic-value-comparison/bad.py +++ b/doc/data/messages/m/magic-value-comparison/bad.py @@ -3,8 +3,8 @@ import random measurement = random.randint(0, 200) above_threshold = False i = 0 -while i < 5: # [magic-value-comparison] - above_threshold = measurement > 100 # [magic-value-comparison] +while i < 5: # [magic-value-comparison] + above_threshold = measurement > 100 # [magic-value-comparison] if above_threshold: break measurement = random.randint(0, 200) diff --git a/doc/data/messages/m/misplaced-format-function/bad.py b/doc/data/messages/m/misplaced-format-function/bad.py index 0bd172369..bc40bba4d 100644 --- a/doc/data/messages/m/misplaced-format-function/bad.py +++ b/doc/data/messages/m/misplaced-format-function/bad.py @@ -1 +1 @@ -print('Value: {}').format('Car') # [misplaced-format-function] +print("Value: {}").format("Car") # [misplaced-format-function] diff --git a/doc/data/messages/m/misplaced-format-function/good.py b/doc/data/messages/m/misplaced-format-function/good.py index 809dcf974..8b31d5cf5 100644 --- a/doc/data/messages/m/misplaced-format-function/good.py +++ b/doc/data/messages/m/misplaced-format-function/good.py @@ -1 +1 @@ -print('Value: {}'.format('Car')) +print("Value: {}".format("Car")) diff --git a/doc/data/messages/m/missing-any-param-doc/bad.py b/doc/data/messages/m/missing-any-param-doc/bad.py index ca92793f5..bf5f232ce 100644 --- a/doc/data/messages/m/missing-any-param-doc/bad.py +++ b/doc/data/messages/m/missing-any-param-doc/bad.py @@ -1,3 +1,3 @@ -def puppies(head, tail): #[missing-any-param-doc] +def puppies(head, tail): # [missing-any-param-doc] """Print puppy's details.""" print(head, tail) diff --git a/doc/data/messages/m/missing-any-param-doc/good.py b/doc/data/messages/m/missing-any-param-doc/good.py index 238ea1bce..6fa9622ee 100644 --- a/doc/data/messages/m/missing-any-param-doc/good.py +++ b/doc/data/messages/m/missing-any-param-doc/good.py @@ -1,7 +1,7 @@ def puppies(head: str, tail: str): """Print puppy's details. - :param head: description of the head of the dog - :param tail: description of the tail of the dog + :param head: description of the head of the dog + :param tail: description of the tail of the dog """ print(head, tail) diff --git a/doc/data/messages/m/missing-class-docstring/bad.py b/doc/data/messages/m/missing-class-docstring/bad.py index 1d0f79c75..e3e1ddbf5 100644 --- a/doc/data/messages/m/missing-class-docstring/bad.py +++ b/doc/data/messages/m/missing-class-docstring/bad.py @@ -1,5 +1,4 @@ class Person: # [missing-class-docstring] - def __init__(self, first_name, last_name): self.first_name = first_name self.last_name = last_name diff --git a/doc/data/messages/m/missing-final-newline/good.py b/doc/data/messages/m/missing-final-newline/good.py index fa1e5072e..02d068916 100644 --- a/doc/data/messages/m/missing-final-newline/good.py +++ b/doc/data/messages/m/missing-final-newline/good.py @@ -1,6 +1,6 @@ # using LF -eat("apple", "candy") # \n +eat("apple", "candy") # \n print(123) # \nEOF # using CRLF diff --git a/doc/data/messages/m/missing-kwoa/bad.py b/doc/data/messages/m/missing-kwoa/bad.py index 4039c8ff2..2b8deabdf 100644 --- a/doc/data/messages/m/missing-kwoa/bad.py +++ b/doc/data/messages/m/missing-kwoa/bad.py @@ -1,5 +1,6 @@ def target(pos, *, keyword): return pos + keyword + def not_forwarding_kwargs(*args, **kwargs): - target(*args) # [missing-kwoa] + target(*args) # [missing-kwoa] diff --git a/doc/data/messages/m/missing-kwoa/good.py b/doc/data/messages/m/missing-kwoa/good.py index abb80a118..c212deb98 100644 --- a/doc/data/messages/m/missing-kwoa/good.py +++ b/doc/data/messages/m/missing-kwoa/good.py @@ -1,5 +1,6 @@ def target(pos, *, keyword): return pos + keyword + def not_forwarding_kwargs(*args, **kwargs): target(*args, **kwargs) diff --git a/doc/data/messages/m/missing-parentheses-for-call-in-test/bad.py b/doc/data/messages/m/missing-parentheses-for-call-in-test/bad.py index 3f67322dc..e4a7172a4 100644 --- a/doc/data/messages/m/missing-parentheses-for-call-in-test/bad.py +++ b/doc/data/messages/m/missing-parentheses-for-call-in-test/bad.py @@ -4,5 +4,6 @@ import random def is_it_a_good_day(): return random.choice([True, False]) + if is_it_a_good_day: # [missing-parentheses-for-call-in-test] print("Today is a good day!") diff --git a/doc/data/messages/m/missing-parentheses-for-call-in-test/good.py b/doc/data/messages/m/missing-parentheses-for-call-in-test/good.py index 63c8ccc89..80afd7769 100644 --- a/doc/data/messages/m/missing-parentheses-for-call-in-test/good.py +++ b/doc/data/messages/m/missing-parentheses-for-call-in-test/good.py @@ -4,5 +4,6 @@ import random def is_it_a_good_day(): return random.choice([True, False]) + if is_it_a_good_day(): print("Today is a good day!") diff --git a/doc/data/messages/m/missing-raises-doc/bad.py b/doc/data/messages/m/missing-raises-doc/bad.py index 9a59fea88..51efd3910 100644 --- a/doc/data/messages/m/missing-raises-doc/bad.py +++ b/doc/data/messages/m/missing-raises-doc/bad.py @@ -4,5 +4,5 @@ def integer_sum(a: int, b: int): # [missing-raises-doc] :param b: second integer """ if not (isinstance(a, int) and isinstance(b, int)): - raise ValueError('Function supports only integer parameters.') + raise ValueError("Function supports only integer parameters.") return a + b diff --git a/doc/data/messages/m/missing-raises-doc/good.py b/doc/data/messages/m/missing-raises-doc/good.py index c274493ea..6ca44d0fd 100644 --- a/doc/data/messages/m/missing-raises-doc/good.py +++ b/doc/data/messages/m/missing-raises-doc/good.py @@ -5,5 +5,5 @@ def integer_sum(a: int, b: int): :raises ValueError: One of the parameters is not an integer. """ if not (isinstance(a, int) and isinstance(b, int)): - raise ValueError('Function supports only integer parameters.') + raise ValueError("Function supports only integer parameters.") return a + b diff --git a/doc/data/messages/m/mixed-line-endings/details.rst b/doc/data/messages/m/mixed-line-endings/details.rst index ab8204529..c1e9b976a 100644 --- a/doc/data/messages/m/mixed-line-endings/details.rst +++ b/doc/data/messages/m/mixed-line-endings/details.rst @@ -1 +1 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! +You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/n/named-expr-without-context/good.py b/doc/data/messages/n/named-expr-without-context/good.py index 50f6b2621..fb088bb99 100644 --- a/doc/data/messages/n/named-expr-without-context/good.py +++ b/doc/data/messages/n/named-expr-without-context/good.py @@ -1,2 +1,2 @@ -if (a := 42): - print('Success') +if a := 42: + print("Success") diff --git a/doc/data/messages/n/no-else-continue/bad.py b/doc/data/messages/n/no-else-continue/bad.py index 5e3172947..a561f93cc 100644 --- a/doc/data/messages/n/no-else-continue/bad.py +++ b/doc/data/messages/n/no-else-continue/bad.py @@ -1,6 +1,6 @@ def even_number_under(n: int): for i in range(n): - if i%2 == 1: # [no-else-continue] + if i % 2 == 1: # [no-else-continue] continue else: yield i diff --git a/doc/data/messages/n/no-else-continue/good.py b/doc/data/messages/n/no-else-continue/good.py index 8aaef7014..e73e0e21c 100644 --- a/doc/data/messages/n/no-else-continue/good.py +++ b/doc/data/messages/n/no-else-continue/good.py @@ -1,5 +1,5 @@ def even_number_under(n: int): for i in range(n): - if i%2 == 1: + if i % 2 == 1: continue yield i diff --git a/doc/data/messages/n/no-else-raise/bad.py b/doc/data/messages/n/no-else-raise/bad.py index d2f590ab8..c5fdf996e 100644 --- a/doc/data/messages/n/no-else-raise/bad.py +++ b/doc/data/messages/n/no-else-raise/bad.py @@ -1,5 +1,5 @@ def integer_sum(a: int, b: int) -> int: - if not (isinstance(a, int) and isinstance(b, int)): # [no-else-raise] - raise ValueError('Function supports only integer parameters.') + if not (isinstance(a, int) and isinstance(b, int)): # [no-else-raise] + raise ValueError("Function supports only integer parameters.") else: return a + b diff --git a/doc/data/messages/n/no-else-raise/good.py b/doc/data/messages/n/no-else-raise/good.py index c0d577cfa..bf2918148 100644 --- a/doc/data/messages/n/no-else-raise/good.py +++ b/doc/data/messages/n/no-else-raise/good.py @@ -1,4 +1,4 @@ def integer_sum(a: int, b: int) -> int: if not (isinstance(a, int) and isinstance(b, int)): - raise ValueError('Function supports only integer parameters.') + raise ValueError("Function supports only integer parameters.") return a + b diff --git a/doc/data/messages/n/no-self-use/bad.py b/doc/data/messages/n/no-self-use/bad.py index 8c44a3c1e..07ab6f3ab 100644 --- a/doc/data/messages/n/no-self-use/bad.py +++ b/doc/data/messages/n/no-self-use/bad.py @@ -1,5 +1,4 @@ class Person: - def developer_greeting(self): # [no-self-use] print("Greetings developer!") diff --git a/doc/data/messages/n/no-value-for-parameter/bad.py b/doc/data/messages/n/no-value-for-parameter/bad.py index cf10d9a57..31b08a16a 100644 --- a/doc/data/messages/n/no-value-for-parameter/bad.py +++ b/doc/data/messages/n/no-value-for-parameter/bad.py @@ -1,4 +1,5 @@ def add(x, y): return x + y + add(1) # [no-value-for-parameter] diff --git a/doc/data/messages/n/no-value-for-parameter/good.py b/doc/data/messages/n/no-value-for-parameter/good.py index e14c45c21..068b52527 100644 --- a/doc/data/messages/n/no-value-for-parameter/good.py +++ b/doc/data/messages/n/no-value-for-parameter/good.py @@ -1,4 +1,5 @@ def add(x, y): return x + y + add(1, 2) diff --git a/doc/data/messages/o/overlapping-except/good.py b/doc/data/messages/o/overlapping-except/good.py index 41a727545..0cace420e 100644 --- a/doc/data/messages/o/overlapping-except/good.py +++ b/doc/data/messages/o/overlapping-except/good.py @@ -7,10 +7,14 @@ def divide_x_by_y(x: float, y: float): # FloatingPointError were already caught at this point print(f"There was an OverflowError or a ZeroDivisionError: {e}") + # Or: + def divide_x_by_y(x: float, y: float): try: print(x / y) except ArithmeticError as e: - print(f"There was an OverflowError, a ZeroDivisionError or a FloatingPointError: {e}") + print( + f"There was an OverflowError, a ZeroDivisionError or a FloatingPointError: {e}" + ) diff --git a/doc/data/messages/p/positional-only-arguments-expected/bad.py b/doc/data/messages/p/positional-only-arguments-expected/bad.py index 30720555a..75e63e572 100644 --- a/doc/data/messages/p/positional-only-arguments-expected/bad.py +++ b/doc/data/messages/p/positional-only-arguments-expected/bad.py @@ -2,4 +2,5 @@ def cube(n, /): """Takes in a number n, returns the cube of n""" return n**3 -cube(n=2) # [positional-only-arguments-expected] + +cube(n=2) # [positional-only-arguments-expected] diff --git a/doc/data/messages/p/positional-only-arguments-expected/good.py b/doc/data/messages/p/positional-only-arguments-expected/good.py index ca734e546..77cdc80a4 100644 --- a/doc/data/messages/p/positional-only-arguments-expected/good.py +++ b/doc/data/messages/p/positional-only-arguments-expected/good.py @@ -2,4 +2,5 @@ def cube(n, /): """Takes in a number n, returns the cube of n""" return n**3 + cube(2) diff --git a/doc/data/messages/r/raw-checker-failed/details.rst b/doc/data/messages/r/raw-checker-failed/details.rst index ab8204529..c1e9b976a 100644 --- a/doc/data/messages/r/raw-checker-failed/details.rst +++ b/doc/data/messages/r/raw-checker-failed/details.rst @@ -1 +1 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! +You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/r/redefined-argument-from-local/bad.py b/doc/data/messages/r/redefined-argument-from-local/bad.py index 24d441219..733f307b3 100644 --- a/doc/data/messages/r/redefined-argument-from-local/bad.py +++ b/doc/data/messages/r/redefined-argument-from-local/bad.py @@ -1,3 +1,4 @@ def show(host_id=10.11): - for host_id, host in [[12.13, 'Venus'], [14.15, 'Mars']]: # [redefined-argument-from-local] + # +1: [redefined-argument-from-local] + for host_id, host in [[12.13, "Venus"], [14.15, "Mars"]]: print(host_id, host) diff --git a/doc/data/messages/r/redefined-argument-from-local/good.py b/doc/data/messages/r/redefined-argument-from-local/good.py index 330f94f45..fd7c081ac 100644 --- a/doc/data/messages/r/redefined-argument-from-local/good.py +++ b/doc/data/messages/r/redefined-argument-from-local/good.py @@ -1,3 +1,3 @@ def show(host_id=10.11): - for inner_host_id, host in [[12.13, 'Venus'], [14.15, 'Mars']]: + for inner_host_id, host in [[12.13, "Venus"], [14.15, "Mars"]]: print(host_id, inner_host_id, host) diff --git a/doc/data/messages/r/relative-beyond-top-level/details.rst b/doc/data/messages/r/relative-beyond-top-level/details.rst index ab8204529..c1e9b976a 100644 --- a/doc/data/messages/r/relative-beyond-top-level/details.rst +++ b/doc/data/messages/r/relative-beyond-top-level/details.rst @@ -1 +1 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! +You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/r/return-arg-in-generator/details.rst b/doc/data/messages/r/return-arg-in-generator/details.rst deleted file mode 100644 index ab8204529..000000000 --- a/doc/data/messages/r/return-arg-in-generator/details.rst +++ /dev/null @@ -1 +0,0 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/r/return-arg-in-generator/good.py b/doc/data/messages/r/return-arg-in-generator/good.py index c40beb573..72dc95e7b 100644 --- a/doc/data/messages/r/return-arg-in-generator/good.py +++ b/doc/data/messages/r/return-arg-in-generator/good.py @@ -1 +1,4 @@ -# This is a placeholder for correct code for this message. +def yield_numbers(): + for number in range(10): + yield number + return "I am now allowed!" # This was not allowed in Python 3.3 and earlier. diff --git a/doc/data/messages/r/return-in-init/bad.py b/doc/data/messages/r/return-in-init/bad.py index 70fc2d0fd..044174e0a 100644 --- a/doc/data/messages/r/return-in-init/bad.py +++ b/doc/data/messages/r/return-in-init/bad.py @@ -1,4 +1,3 @@ class Sum: - def __init__(self, a, b): # [return-in-init] return a + b diff --git a/doc/data/messages/r/return-in-init/good.py b/doc/data/messages/r/return-in-init/good.py index ef8e6e09b..0efe05af4 100644 --- a/doc/data/messages/r/return-in-init/good.py +++ b/doc/data/messages/r/return-in-init/good.py @@ -1,4 +1,3 @@ class Sum: - def __init__(self, a, b) -> None: self.result = a + b diff --git a/doc/data/messages/s/self-cls-assignment/bad.py b/doc/data/messages/s/self-cls-assignment/bad.py index 64541405f..50fe89015 100644 --- a/doc/data/messages/s/self-cls-assignment/bad.py +++ b/doc/data/messages/s/self-cls-assignment/bad.py @@ -1,7 +1,7 @@ class Fruit: @classmethod def list_fruits(cls): - cls = 'apple' # [self-cls-assignment] + cls = "apple" # [self-cls-assignment] def print_color(self, *colors): self = "red" # [self-cls-assignment] diff --git a/doc/data/messages/s/self-cls-assignment/good.py b/doc/data/messages/s/self-cls-assignment/good.py index ae8b172fa..d1960f251 100644 --- a/doc/data/messages/s/self-cls-assignment/good.py +++ b/doc/data/messages/s/self-cls-assignment/good.py @@ -1,7 +1,7 @@ class Fruit: @classmethod def list_fruits(cls): - fruit = 'apple' + fruit = "apple" print(fruit) def print_color(self, *colors): diff --git a/doc/data/messages/s/simplifiable-if-statement/bad.py b/doc/data/messages/s/simplifiable-if-statement/bad.py index 0c9fb317f..1a8d6f0f7 100644 --- a/doc/data/messages/s/simplifiable-if-statement/bad.py +++ b/doc/data/messages/s/simplifiable-if-statement/bad.py @@ -2,7 +2,8 @@ FLYING_THINGS = ["bird", "plane", "superman", "this example"] def is_flying_animal(an_object): - if isinstance(an_object, Animal) and an_object in FLYING_THINGS: # [simplifiable-if-statement] + # +1: [simplifiable-if-statement] + if isinstance(an_object, Animal) and an_object in FLYING_THINGS: is_flying = True else: is_flying = False diff --git a/doc/data/messages/s/subprocess-popen-preexec-fn/bad.py b/doc/data/messages/s/subprocess-popen-preexec-fn/bad.py index c0d3f7bfa..6be75e472 100644 --- a/doc/data/messages/s/subprocess-popen-preexec-fn/bad.py +++ b/doc/data/messages/s/subprocess-popen-preexec-fn/bad.py @@ -5,4 +5,4 @@ def foo(): pass -subprocess.Popen(preexec_fn=foo) # [subprocess-popen-preexec-fn] +subprocess.Popen(preexec_fn=foo) # [subprocess-popen-preexec-fn] diff --git a/doc/data/messages/s/syntax-error/good.py b/doc/data/messages/s/syntax-error/good.py index eccab8746..10a644f1b 100644 --- a/doc/data/messages/s/syntax-error/good.py +++ b/doc/data/messages/s/syntax-error/good.py @@ -1,5 +1 @@ -fruit_stock = { - 'apple': 42, - 'orange': 21, - 'banana': 12 -} +fruit_stock = {"apple": 42, "orange": 21, "banana": 12} diff --git a/doc/data/messages/t/too-few-public-methods/good.py b/doc/data/messages/t/too-few-public-methods/good.py index ca4b5b6fb..b0de1ef75 100644 --- a/doc/data/messages/t/too-few-public-methods/good.py +++ b/doc/data/messages/t/too-few-public-methods/good.py @@ -12,17 +12,22 @@ class Worm: def wiggle(self): print(f"{self.name} wiggle around wormily.") + # or + @dataclasses.dataclass class Worm: - name:str + name: str fruit_of_residence: Fruit + def bore(worm: Worm): print(f"{worm.name} is boring into {worm.fruit_of_residence}") + # or + def bore(fruit: Fruit, worm_name: str): print(f"{worm_name} is boring into {fruit}") diff --git a/doc/data/messages/t/too-many-boolean-expressions/good.py b/doc/data/messages/t/too-many-boolean-expressions/good.py index 1da025460..8405d4f29 100644 --- a/doc/data/messages/t/too-many-boolean-expressions/good.py +++ b/doc/data/messages/t/too-many-boolean-expressions/good.py @@ -1,3 +1,3 @@ def can_be_divided_by_two_and_are_not_zero(x, y, z): - if all(i and i%2==0 for i in [x, y, z]): + if all(i and i % 2 == 0 for i in [x, y, z]): pass diff --git a/doc/data/messages/t/too-many-locals/bad.py b/doc/data/messages/t/too-many-locals/bad.py index dae054ed8..d2a762b49 100644 --- a/doc/data/messages/t/too-many-locals/bad.py +++ b/doc/data/messages/t/too-many-locals/bad.py @@ -20,7 +20,9 @@ def handle_sweets(infos): # [too-many-locals] # Calculate remaining money remaining_money = money - cost_of_children # Calculate time it took - time_it_took_assuming_parallel_eating = time_to_eat_sweet * number_of_sweet_per_child + time_it_took_assuming_parallel_eating = ( + time_to_eat_sweet * number_of_sweet_per_child + ) print( f"{children} ate {cost_of_children}¤ of sweets in {time_it_took_assuming_parallel_eating}, " f"you still have {remaining_money}" diff --git a/doc/data/messages/t/too-many-return-statements/bad.py b/doc/data/messages/t/too-many-return-statements/bad.py index e421d29a7..827177f1b 100644 --- a/doc/data/messages/t/too-many-return-statements/bad.py +++ b/doc/data/messages/t/too-many-return-statements/bad.py @@ -1,16 +1,16 @@ def to_string(x): # [too-many-return-statements] # max of 6 by default, can be configured if x == 1: - return 'This is one.' + return "This is one." if x == 2: - return 'This is two.' + return "This is two." if x == 3: - return 'This is three.' + return "This is three." if x == 4: - return 'This is four.' + return "This is four." if x == 5: - return 'This is five.' + return "This is five." if x == 6: - return 'This is six.' + return "This is six." if x == 7: - return 'This is seven.' + return "This is seven." diff --git a/doc/data/messages/t/too-many-return-statements/good.py b/doc/data/messages/t/too-many-return-statements/good.py index 0c4032f53..80ae2ac19 100644 --- a/doc/data/messages/t/too-many-return-statements/good.py +++ b/doc/data/messages/t/too-many-return-statements/good.py @@ -1,13 +1,13 @@ NUMBERS_TO_STRINGS = { - 1: 'one', - 2: 'two', - 3: 'three', - 4: 'four', - 5: 'five', - 6: 'six', - 7: 'seven' + 1: "one", + 2: "two", + 3: "three", + 4: "four", + 5: "five", + 6: "six", + 7: "seven", } def to_string(x): - return f'This is {NUMBERS_TO_STRINGS.get(x)}.' + return f"This is {NUMBERS_TO_STRINGS.get(x)}." diff --git a/doc/data/messages/t/truncated-format-string/bad.py b/doc/data/messages/t/truncated-format-string/bad.py index 961582bff..a44bca2f3 100644 --- a/doc/data/messages/t/truncated-format-string/bad.py +++ b/doc/data/messages/t/truncated-format-string/bad.py @@ -1,3 +1,3 @@ PARG_2 = 1 -print("strange format %2" % PARG_2) # [truncated-format-string] +print("strange format %2" % PARG_2) # [truncated-format-string] diff --git a/doc/data/messages/u/undefined-all-variable/bad.py b/doc/data/messages/u/undefined-all-variable/bad.py index dd7bef8cb..3168018d5 100644 --- a/doc/data/messages/u/undefined-all-variable/bad.py +++ b/doc/data/messages/u/undefined-all-variable/bad.py @@ -1,4 +1,5 @@ __all__ = ["get_fruit_colour"] # [undefined-all-variable] + def get_fruit_color(): pass diff --git a/doc/data/messages/u/undefined-all-variable/good.py b/doc/data/messages/u/undefined-all-variable/good.py index 3fb85e824..950222b56 100644 --- a/doc/data/messages/u/undefined-all-variable/good.py +++ b/doc/data/messages/u/undefined-all-variable/good.py @@ -1,4 +1,5 @@ __all__ = ["get_fruit_color"] + def get_fruit_color(): pass diff --git a/doc/data/messages/u/unnecessary-direct-lambda-call/bad.py b/doc/data/messages/u/unnecessary-direct-lambda-call/bad.py index 1057f8be6..280fb3b75 100644 --- a/doc/data/messages/u/unnecessary-direct-lambda-call/bad.py +++ b/doc/data/messages/u/unnecessary-direct-lambda-call/bad.py @@ -1 +1 @@ -y = (lambda x: x**2 + 2*x + 1)(a) # [unnecessary-direct-lambda-call] +y = (lambda x: x**2 + 2 * x + 1)(a) # [unnecessary-direct-lambda-call] diff --git a/doc/data/messages/u/unnecessary-direct-lambda-call/good.py b/doc/data/messages/u/unnecessary-direct-lambda-call/good.py index 1fe996f69..5870a4a23 100644 --- a/doc/data/messages/u/unnecessary-direct-lambda-call/good.py +++ b/doc/data/messages/u/unnecessary-direct-lambda-call/good.py @@ -1 +1 @@ -y = a**2 + 2*a + 1 +y = a**2 + 2 * a + 1 diff --git a/doc/data/messages/u/unnecessary-dunder-call/bad.py b/doc/data/messages/u/unnecessary-dunder-call/bad.py index 66149d772..49405d47b 100644 --- a/doc/data/messages/u/unnecessary-dunder-call/bad.py +++ b/doc/data/messages/u/unnecessary-dunder-call/bad.py @@ -1,4 +1,4 @@ -three = 3.0.__str__() # [unnecessary-dunder-call] +three = (3.0).__str__() # [unnecessary-dunder-call] twelve = "1".__add__("2") # [unnecessary-dunder-call] diff --git a/doc/data/messages/u/unnecessary-lambda-assignment/bad.py b/doc/data/messages/u/unnecessary-lambda-assignment/bad.py index b31553e4a..87e7ccdba 100644 --- a/doc/data/messages/u/unnecessary-lambda-assignment/bad.py +++ b/doc/data/messages/u/unnecessary-lambda-assignment/bad.py @@ -1 +1 @@ -foo = lambda x: x**2 + 2*x + 1 # [unnecessary-lambda-assignment] +foo = lambda x: x**2 + 2 * x + 1 # [unnecessary-lambda-assignment] diff --git a/doc/data/messages/u/unnecessary-lambda-assignment/good.py b/doc/data/messages/u/unnecessary-lambda-assignment/good.py index 19c0a07d5..5c7da57a0 100644 --- a/doc/data/messages/u/unnecessary-lambda-assignment/good.py +++ b/doc/data/messages/u/unnecessary-lambda-assignment/good.py @@ -1,2 +1,2 @@ def foo(x): - return x**2 + 2*x + 1 + return x**2 + 2 * x + 1 diff --git a/doc/data/messages/u/unnecessary-list-index-lookup/bad.py b/doc/data/messages/u/unnecessary-list-index-lookup/bad.py index d312d36a0..b671b3add 100644 --- a/doc/data/messages/u/unnecessary-list-index-lookup/bad.py +++ b/doc/data/messages/u/unnecessary-list-index-lookup/bad.py @@ -1,4 +1,4 @@ -letters = ['a', 'b', 'c'] +letters = ["a", "b", "c"] for index, letter in enumerate(letters): print(letters[index]) # [unnecessary-list-index-lookup] diff --git a/doc/data/messages/u/unnecessary-list-index-lookup/good.py b/doc/data/messages/u/unnecessary-list-index-lookup/good.py index 5d3370c0e..2d1a3425c 100644 --- a/doc/data/messages/u/unnecessary-list-index-lookup/good.py +++ b/doc/data/messages/u/unnecessary-list-index-lookup/good.py @@ -1,4 +1,4 @@ -letters = ['a', 'b', 'c'] +letters = ["a", "b", "c"] for index, letter in enumerate(letters): print(letter) diff --git a/doc/data/messages/u/unnecessary-pass/bad.py b/doc/data/messages/u/unnecessary-pass/bad.py index 32eee7f94..c22786f63 100644 --- a/doc/data/messages/u/unnecessary-pass/bad.py +++ b/doc/data/messages/u/unnecessary-pass/bad.py @@ -1,3 +1,4 @@ class Foo: """Foo docstring.""" + pass # [unnecessary-pass] diff --git a/doc/data/messages/u/unrecognized-option/details.rst b/doc/data/messages/u/unrecognized-option/details.rst index ab8204529..c1e9b976a 100644 --- a/doc/data/messages/u/unrecognized-option/details.rst +++ b/doc/data/messages/u/unrecognized-option/details.rst @@ -1 +1 @@ -You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ ! +You can help us make the doc better `by contributing <https://github.com/pylint-dev/pylint/issues/5953>`_ ! diff --git a/doc/data/messages/u/unsupported-binary-operation/good.py b/doc/data/messages/u/unsupported-binary-operation/good.py index 8dc2893c3..6a6be9a72 100644 --- a/doc/data/messages/u/unsupported-binary-operation/good.py +++ b/doc/data/messages/u/unsupported-binary-operation/good.py @@ -1,2 +1,2 @@ masked = 0b111111 & 0b001100 -result = 0xaeff | 0x0b99 +result = 0xAEFF | 0x0B99 diff --git a/doc/data/messages/u/unsupported-membership-test/good.py b/doc/data/messages/u/unsupported-membership-test/good.py index 96b96d4d5..a5af58d5d 100644 --- a/doc/data/messages/u/unsupported-membership-test/good.py +++ b/doc/data/messages/u/unsupported-membership-test/good.py @@ -1,5 +1,6 @@ class Fruit: FRUITS = ["apple", "orange"] + def __contains__(self, name): return name in self.FRUITS diff --git a/doc/data/messages/u/unused-format-string-key/bad.py b/doc/data/messages/u/unused-format-string-key/bad.py index b4c518fc3..7a326da28 100644 --- a/doc/data/messages/u/unused-format-string-key/bad.py +++ b/doc/data/messages/u/unused-format-string-key/bad.py @@ -1,2 +1,5 @@ -"The quick %(color)s fox jumps over the lazy dog." % {"color": "brown", "action": "hops"} -# -1: [unused-format-string-key] +"The quick %(color)s fox jumps over the lazy dog." % { + "color": "brown", + "action": "hops", +} +# -4: [unused-format-string-key] diff --git a/doc/data/messages/u/unused-format-string-key/good.py b/doc/data/messages/u/unused-format-string-key/good.py index 5e45475fd..9347a3d8f 100644 --- a/doc/data/messages/u/unused-format-string-key/good.py +++ b/doc/data/messages/u/unused-format-string-key/good.py @@ -1 +1,4 @@ -"The quick %(color)s fox %(action)s over the lazy dog." % {"color": "brown", "action": "hops"} +"The quick %(color)s fox %(action)s over the lazy dog." % { + "color": "brown", + "action": "hops", +} diff --git a/doc/data/messages/u/unused-wildcard-import/bad.py b/doc/data/messages/u/unused-wildcard-import/bad.py index 8d4858161..74e052c84 100644 --- a/doc/data/messages/u/unused-wildcard-import/bad.py +++ b/doc/data/messages/u/unused-wildcard-import/bad.py @@ -1,4 +1,5 @@ from abc import * # [unused-wildcard-import] -class Animal(ABC): ... +class Animal(ABC): + ... diff --git a/doc/data/messages/u/unused-wildcard-import/good.py b/doc/data/messages/u/unused-wildcard-import/good.py index 961af9915..46fab6d4c 100644 --- a/doc/data/messages/u/unused-wildcard-import/good.py +++ b/doc/data/messages/u/unused-wildcard-import/good.py @@ -1,4 +1,5 @@ from abc import ABC -class Animal(ABC): ... +class Animal(ABC): + ... diff --git a/doc/data/messages/u/use-a-generator/related.rst b/doc/data/messages/u/use-a-generator/related.rst index 5d4660bec..1ec9e139e 100644 --- a/doc/data/messages/u/use-a-generator/related.rst +++ b/doc/data/messages/u/use-a-generator/related.rst @@ -1,2 +1,2 @@ - `PEP 289 – Generator Expressions <https://peps.python.org/pep-0289/>`_ -- `Benchmark and discussion during initial implementation <https://github.com/PyCQA/pylint/pull/3309#discussion_r576683109>`_ +- `Benchmark and discussion during initial implementation <https://github.com/pylint-dev/pylint/pull/3309#discussion_r576683109>`_ diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/bad.py b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/bad.py new file mode 100644 index 000000000..119fd8b43 --- /dev/null +++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/bad.py @@ -0,0 +1,6 @@ +def important_string_manipulation(x: str, y: str) -> None: + if x == "": # [use-implicit-booleaness-not-comparison-to-string] + print("x is an empty string") + + if y != "": # [use-implicit-booleaness-not-comparison-to-string] + print("y is not an empty string") diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/good.py b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/good.py new file mode 100644 index 000000000..21f222e9b --- /dev/null +++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/good.py @@ -0,0 +1,6 @@ +def important_string_manipulation(x: str, y: str) -> None: + if not x: + print("x is an empty string") + + if y: + print("y is not an empty string") diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/pylintrc b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/pylintrc new file mode 100644 index 000000000..aa53d9346 --- /dev/null +++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-string/pylintrc @@ -0,0 +1,2 @@ +[main] +enable=use-implicit-booleaness-not-comparison-to-string diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/bad.py b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/bad.py new file mode 100644 index 000000000..2f93afd31 --- /dev/null +++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/bad.py @@ -0,0 +1,6 @@ +def important_math(x: int, y: int) -> None: + if x == 0: # [use-implicit-booleaness-not-comparison-to-zero] + print("x is equal to zero") + + if y != 0: # [use-implicit-booleaness-not-comparison-to-zero] + print("y is not equal to zero") diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/good.py b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/good.py new file mode 100644 index 000000000..feae7fe30 --- /dev/null +++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/good.py @@ -0,0 +1,6 @@ +def important_math(x: int, y: int) -> None: + if not x: + print("x is equal to zero") + + if y: + print("y is not equal to zero") diff --git a/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/pylintrc b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/pylintrc new file mode 100644 index 000000000..43d8bd751 --- /dev/null +++ b/doc/data/messages/u/use-implicit-booleaness-not-comparison-to-zero/pylintrc @@ -0,0 +1,2 @@ +[main] +enable=use-implicit-booleaness-not-comparison-to-zero diff --git a/doc/data/messages/u/useless-option-value/bad.py b/doc/data/messages/u/useless-option-value/bad.py index 291528732..e284b3fea 100644 --- a/doc/data/messages/u/useless-option-value/bad.py +++ b/doc/data/messages/u/useless-option-value/bad.py @@ -1,3 +1,3 @@ -"""'bad-continuation' was removed from pylint in https://github.com/PyCQA/pylint/pull/3571""" +"""'bad-continuation' was removed from pylint in https://github.com/pylint-dev/pylint/pull/3571""" # pylint: disable=bad-continuation # [useless-option-value] diff --git a/doc/data/messages/u/useless-option-value/good.py b/doc/data/messages/u/useless-option-value/good.py index eb6b246c6..619b5b6f6 100644 --- a/doc/data/messages/u/useless-option-value/good.py +++ b/doc/data/messages/u/useless-option-value/good.py @@ -1 +1 @@ -"""'bad-continuation' was removed from pylint in https://github.com/PyCQA/pylint/pull/3571""" +"""'bad-continuation' was removed from pylint in https://github.com/pylint-dev/pylint/pull/3571""" diff --git a/doc/data/messages/u/useless-parent-delegation/bad.py b/doc/data/messages/u/useless-parent-delegation/bad.py index 9010c9ea9..5132e358c 100644 --- a/doc/data/messages/u/useless-parent-delegation/bad.py +++ b/doc/data/messages/u/useless-parent-delegation/bad.py @@ -1,10 +1,8 @@ class Animal: - def eat(self, food): print(f"Eating {food}") class Human(Animal): - def eat(self, food): # [useless-parent-delegation] super(Human, self).eat(food) diff --git a/doc/data/messages/u/useless-parent-delegation/good.py b/doc/data/messages/u/useless-parent-delegation/good.py index d463b4564..890a43116 100644 --- a/doc/data/messages/u/useless-parent-delegation/good.py +++ b/doc/data/messages/u/useless-parent-delegation/good.py @@ -1,5 +1,4 @@ class Animal: - def eat(self, food): print(f"Eating {food}") diff --git a/doc/data/messages/u/using-constant-test/bad.py b/doc/data/messages/u/using-constant-test/bad.py index aee0b407c..a995d7804 100644 --- a/doc/data/messages/u/using-constant-test/bad.py +++ b/doc/data/messages/u/using-constant-test/bad.py @@ -1,4 +1,4 @@ if 0: # [using-constant-test] - print('This code is never executed.') + print("This code is never executed.") if 1: # [using-constant-test] - print('This code is always executed.') + print("This code is always executed.") diff --git a/doc/data/messages/u/using-constant-test/good.py b/doc/data/messages/u/using-constant-test/good.py index 151e1d518..c8441a924 100644 --- a/doc/data/messages/u/using-constant-test/good.py +++ b/doc/data/messages/u/using-constant-test/good.py @@ -1 +1 @@ -print('This code is always executed.') +print("This code is always executed.") diff --git a/doc/data/messages/w/while-used/bad.py b/doc/data/messages/w/while-used/bad.py index 8839b1a83..44e8df854 100644 --- a/doc/data/messages/w/while-used/bad.py +++ b/doc/data/messages/w/while-used/bad.py @@ -4,9 +4,9 @@ import requests def fetch_data(): i = 1 while i < 6: # [while-used] - print(f'Attempt {i}...') + print(f"Attempt {i}...") try: - return requests.get('https://example.com/data') + return requests.get("https://example.com/data") except requests.exceptions.RequestException: pass i += 1 diff --git a/doc/data/messages/w/while-used/good.py b/doc/data/messages/w/while-used/good.py index 3f2be4860..762d73840 100644 --- a/doc/data/messages/w/while-used/good.py +++ b/doc/data/messages/w/while-used/good.py @@ -3,8 +3,8 @@ import requests def fetch_data(): for i in range(1, 6): - print(f'Attempt {i}...') + print(f"Attempt {i}...") try: - return requests.get('https://example.com/data') + return requests.get("https://example.com/data") except requests.exceptions.RequestException: pass diff --git a/doc/data/messages/w/wrong-exception-operation/bad.py b/doc/data/messages/w/wrong-exception-operation/bad.py index 20fcc2aab..e4aff5d8b 100644 --- a/doc/data/messages/w/wrong-exception-operation/bad.py +++ b/doc/data/messages/w/wrong-exception-operation/bad.py @@ -1,4 +1,4 @@ try: - 1/0 -except (ValueError + TypeError): # [wrong-exception-operation] + 1 / 0 +except ValueError + TypeError: # [wrong-exception-operation] pass diff --git a/doc/data/messages/w/wrong-exception-operation/good.py b/doc/data/messages/w/wrong-exception-operation/good.py index 4171dbb60..b5170dd0e 100644 --- a/doc/data/messages/w/wrong-exception-operation/good.py +++ b/doc/data/messages/w/wrong-exception-operation/good.py @@ -1,4 +1,4 @@ try: - 1/0 + 1 / 0 except (ValueError, TypeError): pass diff --git a/doc/data/messages/w/wrong-import-position/bad.py b/doc/data/messages/w/wrong-import-position/bad.py index f5162adeb..38e442e97 100644 --- a/doc/data/messages/w/wrong-import-position/bad.py +++ b/doc/data/messages/w/wrong-import-position/bad.py @@ -1,7 +1,7 @@ import os -home = os.environ['HOME'] +home = os.environ["HOME"] import sys # [wrong-import-position] -print(f'Home directory is {home}', file=sys.stderr) +print(f"Home directory is {home}", file=sys.stderr) diff --git a/doc/data/messages/w/wrong-import-position/good.py b/doc/data/messages/w/wrong-import-position/good.py index 413e1944e..37330eb23 100644 --- a/doc/data/messages/w/wrong-import-position/good.py +++ b/doc/data/messages/w/wrong-import-position/good.py @@ -1,5 +1,5 @@ import os import sys -home = os.environ['HOME'] -print(f'Home directory is {home}', file=sys.stderr) +home = os.environ["HOME"] +print(f"Home directory is {home}", file=sys.stderr) diff --git a/doc/data/ruff.toml b/doc/data/ruff.toml index da929be3b..773f7a313 100644 --- a/doc/data/ruff.toml +++ b/doc/data/ruff.toml @@ -2,4 +2,12 @@ ignore = [] # Reading ease is drastically reduced on read the doc after 103 chars # (Because of horizontal scrolling) line-length = 103 -select = ["E501"] +select = ["E501", "I"] + + +[per-file-ignores] +"doc/data/messages/r/reimported/bad.py" = ["I"] +"doc/data/messages/w/wrong-import-order/bad.py" = ["I"] +"doc/data/messages/u/ungrouped-imports/bad.py" = ["I"] +"doc/data/messages/m/misplaced-future/bad.py" = ["I"] +"doc/data/messages/m/multiple-imports/bad.py" = ["I"] diff --git a/doc/development_guide/api/epylint.rst b/doc/development_guide/api/epylint.rst deleted file mode 100644 index 8359587ed..000000000 --- a/doc/development_guide/api/epylint.rst +++ /dev/null @@ -1,22 +0,0 @@ -======= -epylint -======= - -To silently run epylint on a ``module_name.py`` module, and get its standard output and error: - -.. sourcecode:: python - - from pylint import epylint as lint - - (pylint_stdout, pylint_stderr) = lint.py_run('module_name.py', return_std=True) - -It is also possible to include additional Pylint options in the first argument to ``py_run``: - -.. sourcecode:: python - - from pylint import epylint as lint - - (pylint_stdout, pylint_stderr) = lint.py_run('module_name.py --disable C0114', return_std=True) - -The options ``--msg-template="{path}:{line}: {category} ({msg_id}, {symbol}, {obj}) {msg}"`` and -``--reports=n`` are set implicitly inside the ``epylint`` module. diff --git a/doc/development_guide/api/index.rst b/doc/development_guide/api/index.rst index 00e6e1a9f..ac4e96900 100644 --- a/doc/development_guide/api/index.rst +++ b/doc/development_guide/api/index.rst @@ -2,7 +2,7 @@ API ### -You can call ``Pylint``, ``epylint``, ``symilar`` and ``pyreverse`` from another +You can call ``Pylint``, ``symilar`` and ``pyreverse`` from another Python program thanks to their APIs: .. sourcecode:: python @@ -19,4 +19,3 @@ Python program thanks to their APIs: :hidden: pylint - epylint diff --git a/doc/development_guide/contributor_guide/contribute.rst b/doc/development_guide/contributor_guide/contribute.rst index 2ebc895b0..dee22aa69 100644 --- a/doc/development_guide/contributor_guide/contribute.rst +++ b/doc/development_guide/contributor_guide/contribute.rst @@ -24,18 +24,18 @@ Here's a list of links you can check depending on what you want to do: - `Reviewing pull requests`_ .. _`Asking a question on discord`: https://discord.com/invite/qYxpadCgkx -.. _`on github`: https://github.com/PyCQA/pylint/issues/new/choose -.. _`Opening an issue`: https://github.com/PyCQA/pylint/issues/new?assignees=&labels=Needs+triage+%3Ainbox_tray%3A&template=BUG-REPORT.yml -.. _`Making the documentation better`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Documentation+%3Agreen_book%3A%22 -.. _`Making the error message better`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+project%3Apycqa%2Fpylint%2F4+ -.. _`Reproducing bugs and confirming that issues are valid`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+reproduction+%3Amag%3A%22%2C%22Cannot+reproduce+%F0%9F%A4%B7%22 -.. _`Investigating or debugging complicated issues`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+investigation+%F0%9F%94%AC%22 -.. _`Designing or specifying a solution`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+design+proposal+%3Alock%3A%22%2C%22Needs+specification+%3Aclosed_lock_with_key%3A%22 -.. _`Giving your opinion on ongoing discussion`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+decision+%3Alock%3A%22 -.. _`Fixing bugs and crashes`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Bug+%3Abeetle%3A%22%2C%22Crash+%F0%9F%92%A5%22 -.. _`Fixing false positives`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22False+Positive+%F0%9F%A6%9F%22 -.. _`Creating new features or fixing false negatives`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22False+Negative+%F0%9F%A6%8B%22%2C%22Enhancement+%E2%9C%A8%22 -.. _`Reviewing pull requests`: https://github.com/PyCQA/pylint/pulls?q=is%3Aopen+is%3Apr+label%3A%22Needs+review+%F0%9F%94%8D%22 +.. _`on github`: https://github.com/pylint-dev/pylint/issues/new/choose +.. _`Opening an issue`: https://github.com/pylint-dev/pylint/issues/new?assignees=&labels=Needs+triage+%3Ainbox_tray%3A&template=BUG-REPORT.yml +.. _`Making the documentation better`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Documentation+%3Agreen_book%3A%22 +.. _`Making the error message better`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen%20is%3Aissue%20project%3Apylint-dev%2Fpylint%2F4 +.. _`Reproducing bugs and confirming that issues are valid`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+reproduction+%3Amag%3A%22%2C%22Cannot+reproduce+%F0%9F%A4%B7%22 +.. _`Investigating or debugging complicated issues`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+investigation+%F0%9F%94%AC%22 +.. _`Designing or specifying a solution`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+design+proposal+%3Alock%3A%22%2C%22Needs+specification+%3Aclosed_lock_with_key%3A%22 +.. _`Giving your opinion on ongoing discussion`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+decision+%3Alock%3A%22 +.. _`Fixing bugs and crashes`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Bug+%3Abeetle%3A%22%2C%22Crash+%F0%9F%92%A5%22 +.. _`Fixing false positives`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22False+Positive+%F0%9F%A6%9F%22 +.. _`Creating new features or fixing false negatives`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22False+Negative+%F0%9F%A6%8B%22%2C%22Enhancement+%E2%9C%A8%22 +.. _`Reviewing pull requests`: https://github.com/pylint-dev/pylint/pulls?q=is%3Aopen+is%3Apr+label%3A%22Needs+review+%F0%9F%94%8D%22 If you are a pylint maintainer there's also: @@ -45,10 +45,10 @@ If you are a pylint maintainer there's also: - `Preparing the next patch release`_ - `Checking stale pull requests status`_ -.. _`Triaging issues`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+triage+%3Ainbox_tray%3A%22 -.. _`Labeling issues that do not have an actionable label yet`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+-label%3A%22Needs+astroid+Brain+%F0%9F%A7%A0%22+-label%3A%22Needs+astroid+update%22+-label%3A%22Needs+backport%22+-label%3A%22Needs+decision+%3Alock%3A%22+-label%3A%22Needs+investigation+%F0%9F%94%AC%22+-label%3A%22Needs+PR%22+-label%3A%22Needs+reproduction+%3Amag%3A%22+-label%3A%22Needs+review+%F0%9F%94%8D%22+-label%3A%22Needs+triage+%3Ainbox_tray%3A%22+-label%3A%22Waiting+on+author%22+-label%3A%22Work+in+progress%22+-label%3AMaintenance+sort%3Aupdated-desc+-label%3A%22Needs+specification+%3Aclosed_lock_with_key%3A%22+-label%3A%22Needs+design+proposal+%3Alock%3A%22 -.. _`Preparing the next patch release`: https://github.com/PyCQA/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+backport%22 -.. _`Checking stale pull requests status`: https://github.com/PyCQA/pylint/pulls?q=is%3Aopen+is%3Apr+label%3A%22Work+in+progress%22%2C%22Needs+astroid+update%22%2C%22Waiting+on+author%22 +.. _`Triaging issues`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+triage+%3Ainbox_tray%3A%22 +.. _`Labeling issues that do not have an actionable label yet`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+-label%3A%22Needs+astroid+Brain+%F0%9F%A7%A0%22+-label%3A%22Needs+astroid+update%22+-label%3A%22Needs+backport%22+-label%3A%22Needs+decision+%3Alock%3A%22+-label%3A%22Needs+investigation+%F0%9F%94%AC%22+-label%3A%22Needs+PR%22+-label%3A%22Needs+reproduction+%3Amag%3A%22+-label%3A%22Needs+review+%F0%9F%94%8D%22+-label%3A%22Needs+triage+%3Ainbox_tray%3A%22+-label%3A%22Waiting+on+author%22+-label%3A%22Work+in+progress%22+-label%3AMaintenance+sort%3Aupdated-desc+-label%3A%22Needs+specification+%3Aclosed_lock_with_key%3A%22+-label%3A%22Needs+design+proposal+%3Alock%3A%22 +.. _`Preparing the next patch release`: https://github.com/pylint-dev/pylint/issues?q=is%3Aopen+is%3Aissue+label%3A%22Needs+backport%22 +.. _`Checking stale pull requests status`: https://github.com/pylint-dev/pylint/pulls?q=is%3Aopen+is%3Apr+label%3A%22Work+in+progress%22%2C%22Needs+astroid+update%22%2C%22Waiting+on+author%22 Creating a pull request @@ -100,7 +100,7 @@ your patch gets accepted: .. _pytest: https://docs.pytest.org/en/latest/ .. _black: https://github.com/psf/black .. _isort: https://github.com/PyCQA/isort -.. _astroid: https://github.com/pycqa/astroid +.. _astroid: https://github.com/pylint-dev/astroid Tips for Getting Started with Pylint Development diff --git a/doc/development_guide/contributor_guide/release.md b/doc/development_guide/contributor_guide/release.md index a076838fd..e1635345b 100644 --- a/doc/development_guide/contributor_guide/release.md +++ b/doc/development_guide/contributor_guide/release.md @@ -39,8 +39,16 @@ branch - Push the tag. - Release the version on GitHub with the same name as the tag and copy and paste the appropriate changelog in the description. This triggers the PyPI release. -- Delete the `maintenance/X.Y-1.x` branch. (For example: `maintenance/2.3.x`) - Create a `maintenance/X.Y.x` (For example: `maintenance/2.4.x` from the `v2.4.0` tag.) +- Upgrade the pattern for the protected branches in the settings under `Branches` / + `Branch protection rules`. (For example: `maintenance/2.4*` instead of + `maintenance/2.3*`.). There's a lot of configuration done in these settings, do NOT + recreate it from scratch. +- Delete the `maintenance/X.Y-1.x` branch. (For example: `maintenance/2.3.x`) +- Select all the issues labelled `backport maintenance/X.Y-1.x` and label them + `backported`, then rename the `backport maintenance/X.Y-1.x` label to + `backport maintenance/X.Y.x` (for example rename `backport maintenance/2.3.x` to + `backport maintenance/2.4.x`) - Close the current milestone and create the new ones (For example: close `2.4.0`, create `2.4.1` and `2.6.0`) - Hide and deactivate all the patch releases for the previous minor release on diff --git a/doc/development_guide/contributor_guide/tests/install.rst b/doc/development_guide/contributor_guide/tests/install.rst index c150d0b91..24783ea2c 100644 --- a/doc/development_guide/contributor_guide/tests/install.rst +++ b/doc/development_guide/contributor_guide/tests/install.rst @@ -10,7 +10,7 @@ Pylint is developed using the git_ distributed version control system. You can clone Pylint using :: - git clone https://github.com/PyCQA/pylint + git clone https://github.com/pylint-dev/pylint Before you start testing your code, you need to install your source-code package locally. Suppose you just cloned pylint with the previous ``git clone`` command. To set up your @@ -34,7 +34,7 @@ If you're testing new changes in astroid you need to also clone astroid_ and ins with an editable installation alongside pylint as follows:: # Suppose you're in the pylint directory - git clone https://github.com/PyCQA/astroid.git + git clone https://github.com/pylint-dev/astroid.git python3 -m pip install -e astroid/ You're now using the local astroid in pylint and can control the version with git for example:: @@ -43,5 +43,5 @@ You're now using the local astroid in pylint and can control the version with gi git switch my-astroid-dev-branch .. _pytest-cov: https://pypi.org/project/pytest-cov/ -.. _astroid: https://github.com/pycqa/astroid +.. _astroid: https://github.com/pylint-dev/astroid .. _git: https://git-scm.com/ diff --git a/doc/development_guide/contributor_guide/tests/launching_test.rst b/doc/development_guide/contributor_guide/tests/launching_test.rst index 02114f01f..78f42e144 100644 --- a/doc/development_guide/contributor_guide/tests/launching_test.rst +++ b/doc/development_guide/contributor_guide/tests/launching_test.rst @@ -7,7 +7,7 @@ pytest Since we use pytest_ to run the tests, you can also use it on its own. We do recommend using the tox_ command though:: - pytest pylint -k test_functional + pytest tests/ -k test_functional You can use pytest_ directly. If you want to run tests on a specific portion of the code with pytest_ and your local python version:: @@ -85,4 +85,4 @@ You can find the latest list of repositories and any relevant code for these tes directory. .. _pytest-cov: https://pypi.org/project/pytest-cov/ -.. _astroid: https://github.com/pycqa/astroid +.. _astroid: https://github.com/pylint-dev/astroid diff --git a/doc/development_guide/contributor_guide/tests/writing_test.rst b/doc/development_guide/contributor_guide/tests/writing_test.rst index c616d172b..9ce9ca1f0 100644 --- a/doc/development_guide/contributor_guide/tests/writing_test.rst +++ b/doc/development_guide/contributor_guide/tests/writing_test.rst @@ -137,4 +137,4 @@ module name should be ``{abspath}`` and the file name ``{relpath}``. .. _tox: https://tox.wiki/en/latest/ .. _pytest: https://docs.pytest.org/en/latest/ .. _pytest-cov: https://pypi.org/project/pytest-cov/ -.. _astroid: https://github.com/pycqa/astroid +.. _astroid: https://github.com/pylint-dev/astroid diff --git a/doc/development_guide/how_tos/custom_checkers.rst b/doc/development_guide/how_tos/custom_checkers.rst index c7b1b64f8..6ab9a9e35 100644 --- a/doc/development_guide/how_tos/custom_checkers.rst +++ b/doc/development_guide/how_tos/custom_checkers.rst @@ -3,11 +3,11 @@ How to Write a Checker ====================== You can find some simple examples in the distribution -(`custom.py <https://github.com/PyCQA/pylint/blob/main/examples/custom.py>`_ +(`custom.py <https://github.com/pylint-dev/pylint/blob/main/examples/custom.py>`_ , -`custom_raw.py <https://github.com/PyCQA/pylint/blob/main/examples/custom_raw.py>`_ +`custom_raw.py <https://github.com/pylint-dev/pylint/blob/main/examples/custom_raw.py>`_ and -`deprecation_checker.py <https://github.com/PyCQA/pylint/blob/main/examples/deprecation_checker.py>`_). +`deprecation_checker.py <https://github.com/pylint-dev/pylint/blob/main/examples/deprecation_checker.py>`_). .. TODO Create custom_token.py diff --git a/doc/development_guide/how_tos/transform_plugins.rst b/doc/development_guide/how_tos/transform_plugins.rst index 031faa0f1..e1f7e9e64 100644 --- a/doc/development_guide/how_tos/transform_plugins.rst +++ b/doc/development_guide/how_tos/transform_plugins.rst @@ -114,4 +114,4 @@ an example, any code transformation can be done by plugins. See `astroid/brain`_ for real life examples of transform plugins. .. _`warnings.py`: https://hg.python.org/cpython/file/2.7/Lib/warnings.py -.. _`astroid/brain`: https://github.com/PyCQA/astroid/tree/main/astroid/brain +.. _`astroid/brain`: https://github.com/pylint-dev/astroid/tree/main/astroid/brain diff --git a/doc/exts/pylint_extensions.py b/doc/exts/pylint_extensions.py index 406d2d39d..cadcbdcba 100755 --- a/doc/exts/pylint_extensions.py +++ b/doc/exts/pylint_extensions.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Script used to generate the extensions file before building the actual documentation.""" @@ -11,8 +11,7 @@ from __future__ import annotations import os import re import sys -import warnings -from typing import Any +from typing import Any, TypedDict import sphinx from sphinx.application import Sphinx @@ -23,11 +22,6 @@ from pylint.lint import PyLinter from pylint.typing import MessageDefinitionTuple, OptionDict, ReportsCallable from pylint.utils import get_rst_title -if sys.version_info >= (3, 8): - from typing import TypedDict -else: - from typing_extensions import TypedDict - class _CheckerInfo(TypedDict): """Represents data about a checker.""" @@ -134,24 +128,20 @@ def get_plugins_info( doc = f.read() try: by_checker[checker]["checker"] = checker - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - by_checker[checker]["options"] += checker.options_and_values() + by_checker[checker]["options"] += checker._options_and_values() by_checker[checker]["msgs"].update(checker.msgs) by_checker[checker]["reports"] += checker.reports by_checker[checker]["doc"] += doc by_checker[checker]["module"] += module except KeyError: - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - by_checker[checker] = _CheckerInfo( - checker=checker, - options=list(checker.options_and_values()), - msgs=dict(checker.msgs), - reports=list(checker.reports), - doc=doc, - module=module, - ) + by_checker[checker] = _CheckerInfo( + checker=checker, + options=list(checker._options_and_values()), + msgs=dict(checker.msgs), + reports=list(checker.reports), + doc=doc, + module=module, + ) return by_checker diff --git a/doc/exts/pylint_features.py b/doc/exts/pylint_features.py index fcf4f01c8..4a8575151 100755 --- a/doc/exts/pylint_features.py +++ b/doc/exts/pylint_features.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Script used to generate the features file before building the actual documentation. diff --git a/doc/exts/pylint_messages.py b/doc/exts/pylint_messages.py index b16f7b026..81a9bc542 100644 --- a/doc/exts/pylint_messages.py +++ b/doc/exts/pylint_messages.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Script used to generate the messages files.""" @@ -336,7 +336,7 @@ def _generate_checker_url(message: MessageData) -> str: checker_module_rel_path = os.path.relpath( message.checker_module_path, PYLINT_BASE_PATH ) - return f"https://github.com/PyCQA/pylint/blob/main/{checker_module_rel_path}" + return f"https://github.com/pylint-dev/pylint/blob/main/{checker_module_rel_path}" def _write_single_shared_message_page( diff --git a/doc/exts/pylint_options.py b/doc/exts/pylint_options.py index 2e6be23e2..170eefd1d 100644 --- a/doc/exts/pylint_options.py +++ b/doc/exts/pylint_options.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Script used to generate the options page.""" diff --git a/doc/pyreverse.rst b/doc/pyreverse.rst index fecbbaf5a..7595683d7 100644 --- a/doc/pyreverse.rst +++ b/doc/pyreverse.rst @@ -5,7 +5,7 @@ Pyreverse ``pyreverse`` analyzes your source code and generates package and class diagrams. -It supports output to ``.dot``/``.gv``, ``.vcg``, ``.puml``/``.plantuml`` (PlantUML) and ``.mmd``/``.html`` (MermaidJS) file formats. +It supports output to ``.dot``/``.gv``, ``.puml``/``.plantuml`` (PlantUML) and ``.mmd``/``.html`` (MermaidJS) file formats. If Graphviz (or the ``dot`` command) is installed, all `output formats supported by Graphviz <https://graphviz.org/docs/outputs/>`_ can be used as well. In this case, ``pyreverse`` first generates a temporary ``.gv`` file, which is then fed to Graphviz to generate the final image. diff --git a/doc/requirements.txt b/doc/requirements.txt index 1a9e621b6..62b6b6b0f 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,6 @@ -Sphinx==6.1.3 +Sphinx==6.2.0 sphinx-reredirects<1 -myst-parser~=0.19 +myst-parser~=1.0 towncrier~=22.12 -furo==2022.12.7 +furo==2023.3.27 -e . diff --git a/doc/symilar.rst b/doc/symilar.rst index 5b75ff38f..fd7124e1d 100644 --- a/doc/symilar.rst +++ b/doc/symilar.rst @@ -20,7 +20,6 @@ All files that shall be checked have to be passed in explicitly, e.g.:: ==tests/data/suppliermodule_test.py:12 class Ancestor: """ Ancestor method """ - __implements__ = (Interface,) cls_member = DoNothing() def __init__(self, value): diff --git a/doc/test_messages_documentation.py b/doc/test_messages_documentation.py index 80e44c4a2..058dcbe49 100644 --- a/doc/test_messages_documentation.py +++ b/doc/test_messages_documentation.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Functional tests for the code examples in the messages' documentation.""" diff --git a/doc/user_guide/checkers/extensions.rst b/doc/user_guide/checkers/extensions.rst index 793b3889b..79a797a7c 100644 --- a/doc/user_guide/checkers/extensions.rst +++ b/doc/user_guide/checkers/extensions.rst @@ -10,7 +10,6 @@ Pylint provides the following optional plugins: - :ref:`pylint.extensions.broad_try_clause` - :ref:`pylint.extensions.check_elif` - :ref:`pylint.extensions.code_style` -- :ref:`pylint.extensions.comparetozero` - :ref:`pylint.extensions.comparison_placement` - :ref:`pylint.extensions.confusing_elif` - :ref:`pylint.extensions.consider_refactoring_into_while_condition` @@ -20,7 +19,6 @@ Pylint provides the following optional plugins: - :ref:`pylint.extensions.docstyle` - :ref:`pylint.extensions.dunder` - :ref:`pylint.extensions.empty_comment` -- :ref:`pylint.extensions.emptystring` - :ref:`pylint.extensions.eq_without_hash` - :ref:`pylint.extensions.for_any_all` - :ref:`pylint.extensions.magic_value` @@ -88,34 +86,6 @@ Code Style checker Messages to. This can be changed to be an augmented assign. Disabled by default! -.. _pylint.extensions.emptystring: - -Compare-To-Empty-String checker -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This checker is provided by ``pylint.extensions.emptystring``. -Verbatim name of the checker is ``compare-to-empty-string``. - -Compare-To-Empty-String checker Messages -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -:compare-to-empty-string (C1901): *"%s" can be simplified to "%s" as an empty string is falsey* - Used when Pylint detects comparison to an empty string constant. - - -.. _pylint.extensions.comparetozero: - -Compare-To-Zero checker -~~~~~~~~~~~~~~~~~~~~~~~ - -This checker is provided by ``pylint.extensions.comparetozero``. -Verbatim name of the checker is ``compare-to-zero``. - -Compare-To-Zero checker Messages -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -:compare-to-zero (C2001): *"%s" can be simplified to "%s" as 0 is falsey* - Used when Pylint detects comparison to a 0 constant. - - .. _pylint.extensions.comparison_placement: Comparison-Placement checker diff --git a/doc/user_guide/checkers/features.rst b/doc/user_guide/checkers/features.rst index 9a7c8a4ff..eb716d389 100644 --- a/doc/user_guide/checkers/features.rst +++ b/doc/user_guide/checkers/features.rst @@ -893,10 +893,21 @@ Refactoring checker Messages Emitted when a single "return" or "return None" statement is found at the end of function or method definition. This statement can safely be removed because Python will implicitly return None -:use-implicit-booleaness-not-comparison (C1803): *'%s' can be simplified to '%s' as an empty %s is falsey* - Used when Pylint detects that collection literal comparison is being used to - check for emptiness; Use implicit booleaness instead of a collection classes; - empty collections are considered as false +:use-implicit-booleaness-not-comparison-to-string (C1804): *"%s" can be simplified to "%s", if it is striclty a string, as an empty string is falsey* + Empty string are considered false in a boolean context. Following this check + blindly in weakly typed code base can create hard to debug issues. If the + value can be something else that is falsey but not a string (for example + ``None``, an empty sequence, or ``0``) the code will not be equivalent. +:use-implicit-booleaness-not-comparison (C1803): *"%s" can be simplified to "%s", if it is strictly a sequence, as an empty %s is falsey* + Empty sequences are considered false in a boolean context. Following this + check blindly in weakly typed code base can create hard to debug issues. If + the value can be something else that is falsey but not a sequence (for + example ``None``, an empty string, or ``0``) the code will not be equivalent. +:use-implicit-booleaness-not-comparison-to-zero (C1805): *"%s" can be simplified to "%s", if it is strictly an int, as 0 is falsey* + 0 is considered false in a boolean context. Following this check blindly in + weakly typed code base can create hard to debug issues. If the value can be + something else that is falsey but not an int (for example ``None``, an empty + string, or an empty sequence) the code will not be equivalent. :unneeded-not (C0113): *Consider changing "%s" to "%s"* Used when a boolean expression contains an unneeded negation. :consider-iterating-dictionary (C0201): *Consider iterating the dictionary directly instead of calling .keys()* @@ -912,13 +923,12 @@ Refactoring checker Messages Emitted when code that iterates with range and len is encountered. Such code can be simplified by using the enumerate builtin. :use-implicit-booleaness-not-len (C1802): *Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty* - Used when Pylint detects that len(sequence) is being used without explicit - comparison inside a condition to determine if a sequence is empty. Instead of - coercing the length to a boolean, either rely on the fact that empty - sequences are false or compare the length against a scalar. -:consider-using-f-string (C0209): *Formatting a regular string which could be a f-string* + Empty sequences are considered false in a boolean context. You can either + remove the call to 'len' (``if not x``) or compare the length against ascalar + (``if len(x) > 1``). +:consider-using-f-string (C0209): *Formatting a regular string which could be an f-string* Used when we detect a string that is being formatted with format() or % which - could potentially be a f-string. The use of f-strings is preferred. Requires + could potentially be an f-string. The use of f-strings is preferred. Requires Python 3.6 and ``py-version >= 3.6``. :use-maxsplit-arg (C0207): *Use %s instead* Emitted when accessing only the first or last element of str.split(). The @@ -1308,7 +1318,7 @@ Unsupported Version checker Messages ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :using-f-string-in-unsupported-version (W2601): *F-strings are not supported by all versions included in the py-version setting* Used when the py-version set by the user is lower than 3.6 and pylint - encounters a f-string. + encounters an f-string. :using-final-decorator-in-unsupported-version (W2602): *typing.final is not supported by all versions included in the py-version setting* Used when the py-version set by the user is lower than 3.8 and pylint encounters a ``typing.final`` decorator. diff --git a/doc/user_guide/configuration/all-options.rst b/doc/user_guide/configuration/all-options.rst index ecdfc9ef5..8b68ab7dd 100644 --- a/doc/user_guide/configuration/all-options.rst +++ b/doc/user_guide/configuration/all-options.rst @@ -233,7 +233,7 @@ Standard Checkers confidence = ["HIGH", "CONTROL_FLOW", "INFERENCE", "INFERENCE_FAILURE", "UNDEFINED"] - disable = ["raw-checker-failed", "bad-inline-option", "locally-disabled", "file-ignored", "suppressed-message", "useless-suppression", "deprecated-pragma", "use-symbolic-message-instead", "consider-using-augmented-assign"] + disable = ["raw-checker-failed", "bad-inline-option", "locally-disabled", "file-ignored", "suppressed-message", "useless-suppression", "deprecated-pragma", "use-implicit-booleaness-not-comparison-to-string", "use-implicit-booleaness-not-comparison-to-zero", "use-symbolic-message-instead", "consider-using-augmented-assign"] enable = [] diff --git a/doc/user_guide/installation/badge.rst b/doc/user_guide/installation/badge.rst index 8463d40b3..3c5df9e82 100644 --- a/doc/user_guide/installation/badge.rst +++ b/doc/user_guide/installation/badge.rst @@ -7,16 +7,16 @@ Show your usage You can place this badge in your README to let others know your project uses pylint. .. image:: https://img.shields.io/badge/linting-pylint-yellowgreen - :target: https://github.com/PyCQA/pylint + :target: https://github.com/pylint-dev/pylint Use the badge in your project's README.md (or any other Markdown file):: - [![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/PyCQA/pylint) + [![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint) Use the badge in your project's README.rst (or any other rst file):: .. image:: https://img.shields.io/badge/linting-pylint-yellowgreen - :target: https://github.com/PyCQA/pylint + :target: https://github.com/pylint-dev/pylint If you use GitHub Actions, and one of your CI workflows begins with "name: pylint", you diff --git a/doc/user_guide/installation/ide_integration/flymake-emacs.rst b/doc/user_guide/installation/ide_integration/flymake-emacs.rst index 79310ff59..64aad8a66 100644 --- a/doc/user_guide/installation/ide_integration/flymake-emacs.rst +++ b/doc/user_guide/installation/ide_integration/flymake-emacs.rst @@ -4,75 +4,6 @@ Using Pylint through Flymake in Emacs ===================================== .. warning:: - The Emacs package now has its own repository and is looking for a maintainer. - If you're reading this doc and are interested in maintaining this package or - are actually using flymake please open an issue at - https://github.com/emacsorphanage/pylint/issues/new/choose - -To enable Flymake for Python, insert the following into your .emacs: - -.. sourcecode:: common-lisp - - ;; Configure Flymake for Python - (when (load "flymake" t) - (defun flymake-pylint-init () - (let* ((temp-file (flymake-init-create-temp-buffer-copy - 'flymake-create-temp-inplace)) - (local-file (file-relative-name - temp-file - (file-name-directory buffer-file-name)))) - (list "epylint" (list local-file)))) - (add-to-list 'flymake-allowed-file-name-masks - '("\\.py\\'" flymake-pylint-init))) - - ;; Set as a minor mode for Python - (add-hook 'python-mode-hook '(lambda () (flymake-mode))) - -Above stuff is in ``pylint/elisp/pylint-flymake.el``, which should be automatically -installed on Debian systems, in which cases you don't have to put it in your ``.emacs`` file. - -Other things you may find useful to set: - -.. sourcecode:: common-lisp - - ;; Configure to wait a bit longer after edits before starting - (setq-default flymake-no-changes-timeout '3) - - ;; Keymaps to navigate to the errors - (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map "\C-cn" 'flymake-goto-next-error))) - (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map "\C-cp" 'flymake-goto-prev-error))) - - -Finally, by default Flymake only displays the extra information about the error when you -hover the mouse over the highlighted line. The following will use the minibuffer to display -messages when you the cursor is on the line. - -.. sourcecode:: common-lisp - - ;; To avoid having to mouse hover for the error message, these functions make Flymake error messages - ;; appear in the minibuffer - (defun show-fly-err-at-point () - "If the cursor is sitting on a Flymake error, display the message in the minibuffer" - (require 'cl) - (interactive) - (let ((line-no (line-number-at-pos))) - (dolist (elem flymake-err-info) - (if (eq (car elem) line-no) - (let ((err (car (second elem)))) - (message "%s" (flymake-ler-text err))))))) - - (add-hook 'post-command-hook 'show-fly-err-at-point) - - -Alternative, if you only wish to pollute the minibuffer after an explicit flymake-goto-* then use -the following instead of a post-command-hook - -.. sourcecode:: common-lisp - - (defadvice flymake-goto-next-error (after display-message activate compile) - "Display the error in the mini-buffer rather than having to mouse over it" - (show-fly-err-at-point)) - - (defadvice flymake-goto-prev-error (after display-message activate compile) - "Display the error in the mini-buffer rather than having to mouse over it" - (show-fly-err-at-point)) + epylint was deprecated in 2.16.0 and targeted for deletion in 3.0.0. + All emacs and flymake related files were removed and their support will + now happen in an external repository: https://github.com/emacsorphanage/pylint. diff --git a/doc/user_guide/messages/messages_overview.rst b/doc/user_guide/messages/messages_overview.rst index 167802ae2..9515fecb4 100644 --- a/doc/user_guide/messages/messages_overview.rst +++ b/doc/user_guide/messages/messages_overview.rst @@ -390,8 +390,6 @@ All messages in the convention category: convention/bad-file-encoding convention/bad-mcs-classmethod-argument convention/bad-mcs-method-argument - convention/compare-to-empty-string - convention/compare-to-zero convention/consider-iterating-dictionary convention/consider-using-any-or-all convention/consider-using-dict-items @@ -433,6 +431,8 @@ All messages in the convention category: convention/unnecessary-lambda-assignment convention/unneeded-not convention/use-implicit-booleaness-not-comparison + convention/use-implicit-booleaness-not-comparison-to-string + convention/use-implicit-booleaness-not-comparison-to-zero convention/use-implicit-booleaness-not-len convention/use-maxsplit-arg convention/use-sequence-for-iteration @@ -449,6 +449,8 @@ All renamed messages in the convention category: :titlesonly: convention/blacklisted-name + convention/compare-to-empty-string + convention/compare-to-zero convention/len-as-condition convention/missing-docstring convention/old-misplaced-comparison-constant diff --git a/doc/user_guide/usage/run.rst b/doc/user_guide/usage/run.rst index b9dfedc88..7e6e1a830 100644 --- a/doc/user_guide/usage/run.rst +++ b/doc/user_guide/usage/run.rst @@ -105,6 +105,9 @@ configuration file in the following order and uses the first one it finds: providing it has at least one ``pylint.`` section #. ``tox.ini`` in the current working directory, providing it has at least one ``pylint.`` section +#. Pylint will search for the ``pyproject.toml`` file up the directories hierarchy + unless it's found, or a ``.git``/``.hg`` directory is found, or the file system root + is approached. #. If the current working directory is in a Python package, Pylint searches \ up the hierarchy of Python packages until it finds a ``pylintrc`` file. \ This allows you to specify coding standards on a module-by-module \ diff --git a/doc/whatsnew/2/2.1/full.rst b/doc/whatsnew/2/2.1/full.rst index a1e7e24c1..03d1e82ac 100644 --- a/doc/whatsnew/2/2.1/full.rst +++ b/doc/whatsnew/2/2.1/full.rst @@ -42,7 +42,7 @@ Release date: 2018-08-01 * Correctly handle the new name of the Python implementation of the ``abc`` module. - Closes PyCQA/astroid#2288 + Closes pylint-dev/astroid#2288 * Modules with ``__getattr__`` are exempted by default from ``no-member`` diff --git a/doc/whatsnew/2/2.10/summary.rst b/doc/whatsnew/2/2.10/summary.rst index 6b3689643..814fd94f5 100644 --- a/doc/whatsnew/2/2.10/summary.rst +++ b/doc/whatsnew/2/2.10/summary.rst @@ -21,7 +21,7 @@ We're going to continue working on improving performance during 2.11. We're also a new ``possible-forgotten-f-prefix`` check that had too much false positives at release time. Check the `possible-forgotten-f-prefix`_ issue if you want to provide knowledge or use case :) -.. _possible-forgotten-f-prefix: https://github.com/PyCQA/pylint/pull/4787 +.. _possible-forgotten-f-prefix: https://github.com/pylint-dev/pylint/pull/4787 New checkers ============ diff --git a/doc/whatsnew/2/2.11/summary.rst b/doc/whatsnew/2/2.11/summary.rst index 39851b0e8..1d16bc521 100644 --- a/doc/whatsnew/2/2.11/summary.rst +++ b/doc/whatsnew/2/2.11/summary.rst @@ -26,7 +26,7 @@ The future ``possible-forgotten-f-prefix`` check still had too much false positi and is delayed again. Check the `possible-forgotten-f-prefix`_ issue if you want to provide knowledge or use case :) -.. _possible-forgotten-f-prefix: https://github.com/PyCQA/pylint/pull/4787 +.. _possible-forgotten-f-prefix: https://github.com/pylint-dev/pylint/pull/4787 .. _pyupgrade: https://github.com/asottile/pyupgrade .. _flynt: https://github.com/ikamensh/flynt diff --git a/doc/whatsnew/2/2.12/full.rst b/doc/whatsnew/2/2.12/full.rst index 923dd9a25..d3f7d0922 100644 --- a/doc/whatsnew/2/2.12/full.rst +++ b/doc/whatsnew/2/2.12/full.rst @@ -83,7 +83,7 @@ Release date: 2021-11-24 and allows it to be checked against actual output in a test. * Fix a crash in the ``check_elif`` extensions where an undetected if in a comprehension - with an if statement within a f-string resulted in an out of range error. The checker no + with an if statement within an f-string resulted in an out of range error. The checker no longer relies on counting if statements anymore and uses known if statements locations instead. It should not crash on badly parsed if statements anymore. diff --git a/doc/whatsnew/2/2.13/full.rst b/doc/whatsnew/2/2.13/full.rst index f723731dc..797648431 100644 --- a/doc/whatsnew/2/2.13/full.rst +++ b/doc/whatsnew/2/2.13/full.rst @@ -250,7 +250,7 @@ Release date: 2022-03-24 * No longer emit ``no-member`` in for loops that reference ``self`` if the binary operation that started the for loop uses a ``self`` that is encapsulated in tuples or lists. - Refs PyCQA/astroid#1360 + Refs pylint-dev/astroid#1360 Closes #4826 * Output better error message if unsupported file formats are used with ``pyreverse``. @@ -389,7 +389,7 @@ Release date: 2022-03-24 * Fixed a crash involving a ``NewType`` named with an f-string. Closes #5770 - Ref PyCQA/astroid#1400 + Ref pylint-dev/astroid#1400 * Improved ``bad-open-mode`` message when providing ``None`` to the ``mode`` argument of an ``open()`` call. @@ -406,13 +406,13 @@ Release date: 2022-03-24 the class itself. Closes #5408 - Ref PyCQA/astroid#1392 + Ref pylint-dev/astroid#1392 * Fixed false positive for ``unused-argument`` when a method overridden in a subclass does nothing with the value of a keyword-only argument. Closes #5771 - Ref PyCQA/astroid#1382 + Ref pylint-dev/astroid#1382 * The issue template for crashes is now created for crashes which were previously not covered by this mechanism. diff --git a/doc/whatsnew/2/2.13/summary.rst b/doc/whatsnew/2/2.13/summary.rst index 73d377a76..ddfb98f84 100644 --- a/doc/whatsnew/2/2.13/summary.rst +++ b/doc/whatsnew/2/2.13/summary.rst @@ -16,7 +16,7 @@ A lot of ``undefined-variables`` and ``used-before-assignment`` issues were reso We started integrating ``pylint-error`` the documentation created by @vald-phoenix a developer from Hlyniane, Ukraine. We hope he's doing well despite the current situation. The deployment is set up but `there's still a lot to do so we welcome any community effort -help to review, integrate, and add good/bad examples <https://github.com/PyCQA/pylint/issues/5953>`_. This should be doable +help to review, integrate, and add good/bad examples <https://github.com/pylint-dev/pylint/issues/5953>`_. This should be doable without any pylint or astroid knowledge, so this is the perfect entrypoint if you want to contribute to pylint without investing any time learning the internals. @@ -144,7 +144,7 @@ Other Changes * No longer emit ``no-member`` in for loops that reference ``self`` if the binary operation that started the for loop uses a ``self`` that is encapsulated in tuples or lists. - Refs PyCQA/astroid#1360 + Refs pylint-dev/astroid#1360 Closes #4826 * Fix matching ``--notes`` options that end in a non-word character. @@ -295,13 +295,13 @@ Other Changes the class itself. Closes #5408 - RefsPyCQA/astroid#1392 + Refs pylint-dev/astroid#1392 * Fixed false positive for ``unused-argument`` when a method overridden in a subclass does nothing with the value of a keyword-only argument. Closes #5771 - RefsPyCQA/astroid#1382 + Refs pylint-dev/astroid#1382 * Optimize parsing of long lines when ``missing-final-newline`` is enabled. @@ -343,7 +343,7 @@ Other Changes * Fixed a crash involving a ``NewType`` named with an f-string. Closes #5770 - RefsPyCQA/astroid#1400 + Refs pylint-dev/astroid#1400 * Improved ``bad-open-mode`` message when providing ``None`` to the ``mode`` argument of an ``open()`` call. diff --git a/doc/whatsnew/2/2.14/summary.rst b/doc/whatsnew/2/2.14/summary.rst index 9ef0f04d9..7101c69b6 100644 --- a/doc/whatsnew/2/2.14/summary.rst +++ b/doc/whatsnew/2/2.14/summary.rst @@ -23,7 +23,7 @@ maintainer that depends on pylint, please verify that you're ready for pylint 3. by activating deprecation warnings. We continued the integration of ``pylint-error`` and are now at 33%!. We still welcome any community effort -to help review, integrate, and add good/bad examples <https://github.com/PyCQA/pylint/issues/5953>`_. This should be doable +to help review, integrate, and add good/bad examples <https://github.com/pylint-dev/pylint/issues/5953>`_. This should be doable without any ``pylint`` or ``astroid`` knowledge, so this is the perfect entrypoint if you want to contribute to ``pylint`` or open source without any experience with our code! diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index aab05caef..91e70e341 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -18,7 +18,7 @@ We improved ``pylint``'s handling of namespace packages. More packages should be linted without resorting to using the ``--recursive=y`` option. We still welcome any community effort to help review, integrate, and add good/bad examples to the doc for -<https://github.com/PyCQA/pylint/issues/5953>`_. This should be doable without any ``pylint`` or ``astroid`` +<https://github.com/pylint-dev/pylint/issues/5953>`_. This should be doable without any ``pylint`` or ``astroid`` knowledge, so this is the perfect entrypoint if you want to contribute to ``pylint`` or open source without any experience with our code! @@ -39,23 +39,23 @@ False Positives Fixed - Fix ``use-sequence-for-iteration`` when unpacking a set with ``*``. - Closes #5788 (`#5788 <https://github.com/PyCQA/pylint/issues/5788>`_) + Closes #5788 (`#5788 <https://github.com/pylint-dev/pylint/issues/5788>`_) - Fix false positive ``assigning-non-slot`` when a class attribute is re-assigned. - Closes #6001 (`#6001 <https://github.com/PyCQA/pylint/issues/6001>`_) + Closes #6001 (`#6001 <https://github.com/pylint-dev/pylint/issues/6001>`_) - Fixes ``used-before-assignment`` false positive when the walrus operator is used in a ternary operator. - Closes #7779 (`#7779 <https://github.com/PyCQA/pylint/issues/7779>`_) + Closes #7779 (`#7779 <https://github.com/pylint-dev/pylint/issues/7779>`_) - Prevent ``used-before-assignment`` when imports guarded by ``if TYPE_CHECKING`` are guarded again when used. - Closes #7979 (`#7979 <https://github.com/PyCQA/pylint/issues/7979>`_) + Closes #7979 (`#7979 <https://github.com/pylint-dev/pylint/issues/7979>`_) @@ -64,7 +64,7 @@ Other Bug Fixes - Using custom braces in ``msg-template`` will now work properly. - Closes #5636 (`#5636 <https://github.com/PyCQA/pylint/issues/5636>`_) + Closes #5636 (`#5636 <https://github.com/pylint-dev/pylint/issues/5636>`_) What's new in Pylint 2.15.9? @@ -78,7 +78,7 @@ False Positives Fixed - Fix false-positive for ``used-before-assignment`` in pattern matching with a guard. - Closes #5327 (`#5327 <https://github.com/PyCQA/pylint/issues/5327>`_) + Closes #5327 (`#5327 <https://github.com/pylint-dev/pylint/issues/5327>`_) @@ -88,17 +88,17 @@ Other Bug Fixes - Pylint will no longer deadlock if a parallel job is killed but fail immediately instead. - Closes #3899 (`#3899 <https://github.com/PyCQA/pylint/issues/3899>`_) + Closes #3899 (`#3899 <https://github.com/pylint-dev/pylint/issues/3899>`_) - When pylint exit due to bad arguments being provided the exit code will now be the expected ``32``. - Refs #7931 (`#7931 <https://github.com/PyCQA/pylint/issues/7931>`_) + Refs #7931 (`#7931 <https://github.com/pylint-dev/pylint/issues/7931>`_) - Fixes a ``ModuleNotFound`` exception when running pylint on a Django project with the ``pylint_django`` plugin enabled. - Closes #7938 (`#7938 <https://github.com/PyCQA/pylint/issues/7938>`_) + Closes #7938 (`#7938 <https://github.com/pylint-dev/pylint/issues/7938>`_) What's new in Pylint 2.15.8? @@ -112,26 +112,26 @@ False Positives Fixed - Document a known false positive for ``useless-suppression`` when disabling ``line-too-long`` in a module with only comments and no code. - Closes #3368 (`#3368 <https://github.com/PyCQA/pylint/issues/3368>`_) + Closes #3368 (`#3368 <https://github.com/pylint-dev/pylint/issues/3368>`_) - Fix ``logging-fstring-interpolation`` false positive raised when logging and f-string with ``%s`` formatting. - Closes #4984 (`#4984 <https://github.com/PyCQA/pylint/issues/4984>`_) + Closes #4984 (`#4984 <https://github.com/pylint-dev/pylint/issues/4984>`_) - Fixes false positive ``abstract-method`` on Protocol classes. - Closes #7209 (`#7209 <https://github.com/PyCQA/pylint/issues/7209>`_) + Closes #7209 (`#7209 <https://github.com/pylint-dev/pylint/issues/7209>`_) - Fix ``missing-param-doc`` false positive when function parameter has an escaped underscore. - Closes #7827 (`#7827 <https://github.com/PyCQA/pylint/issues/7827>`_) + Closes #7827 (`#7827 <https://github.com/pylint-dev/pylint/issues/7827>`_) - ``multiple-statements`` no longer triggers for function stubs using inlined ``...``. - Closes #7860 (`#7860 <https://github.com/PyCQA/pylint/issues/7860>`_) + Closes #7860 (`#7860 <https://github.com/pylint-dev/pylint/issues/7860>`_) What's new in Pylint 2.15.7? @@ -145,12 +145,12 @@ False Positives Fixed - Fix ``deprecated-method`` false positive when alias for method is similar to name of deprecated method. - Closes #5886 (`#5886 <https://github.com/PyCQA/pylint/issues/5886>`_) + Closes #5886 (`#5886 <https://github.com/pylint-dev/pylint/issues/5886>`_) - Fix a false positive for ``used-before-assignment`` for imports guarded by ``typing.TYPE_CHECKING`` later used in variable annotations. - Closes #7609 (`#7609 <https://github.com/PyCQA/pylint/issues/7609>`_) + Closes #7609 (`#7609 <https://github.com/pylint-dev/pylint/issues/7609>`_) @@ -161,12 +161,12 @@ Other Bug Fixes should be the same whether a file is given/discovered multiple times or not. - Closes #6242, #4053 (`#6242 <https://github.com/PyCQA/pylint/issues/6242>`_) + Closes #6242, #4053 (`#6242 <https://github.com/pylint-dev/pylint/issues/6242>`_) - Fixes a crash in ``stop-iteration-return`` when the ``next`` builtin is called without arguments. - Closes #7828 (`#7828 <https://github.com/PyCQA/pylint/issues/7828>`_) + Closes #7828 (`#7828 <https://github.com/pylint-dev/pylint/issues/7828>`_) What's new in Pylint 2.15.6? @@ -180,17 +180,17 @@ False Positives Fixed - Fix false positive for ``unhashable-member`` when subclassing ``dict`` and using the subclass as a dictionary key. - Closes #7501 (`#7501 <https://github.com/PyCQA/pylint/issues/7501>`_) + Closes #7501 (`#7501 <https://github.com/pylint-dev/pylint/issues/7501>`_) - ``unnecessary-list-index-lookup`` will not be wrongly emitted if ``enumerate`` is called with ``start``. - Closes #7682 (`#7682 <https://github.com/PyCQA/pylint/issues/7682>`_) + Closes #7682 (`#7682 <https://github.com/pylint-dev/pylint/issues/7682>`_) - Don't warn about ``stop-iteration-return`` when using ``next()`` over ``itertools.cycle``. - Closes #7765 (`#7765 <https://github.com/PyCQA/pylint/issues/7765>`_) + Closes #7765 (`#7765 <https://github.com/pylint-dev/pylint/issues/7765>`_) @@ -200,21 +200,21 @@ Other Bug Fixes - Messages sent to reporter are now copied so a reporter cannot modify the message sent to other reporters. - Closes #7214 (`#7214 <https://github.com/PyCQA/pylint/issues/7214>`_) + Closes #7214 (`#7214 <https://github.com/pylint-dev/pylint/issues/7214>`_) - Fixes edge case of custom method named ``next`` raised an astroid error. - Closes #7610 (`#7610 <https://github.com/PyCQA/pylint/issues/7610>`_) + Closes #7610 (`#7610 <https://github.com/pylint-dev/pylint/issues/7610>`_) - Fix crash that happened when parsing files with unexpected encoding starting with 'utf' like ``utf13``. - Closes #7661 (`#7661 <https://github.com/PyCQA/pylint/issues/7661>`_) + Closes #7661 (`#7661 <https://github.com/pylint-dev/pylint/issues/7661>`_) - Fix a crash when a child class with an ``__init__`` method inherits from a parent class with an ``__init__`` class attribute. - Closes #7742 (`#7742 <https://github.com/PyCQA/pylint/issues/7742>`_) + Closes #7742 (`#7742 <https://github.com/pylint-dev/pylint/issues/7742>`_) What's new in Pylint 2.15.5? @@ -228,7 +228,7 @@ False Positives Fixed - Fix a false positive for ``simplify-boolean-expression`` when multiple values are inferred for a constant. - Closes #7626 (`#7626 <https://github.com/PyCQA/pylint/issues/7626>`_) + Closes #7626 (`#7626 <https://github.com/pylint-dev/pylint/issues/7626>`_) @@ -238,7 +238,7 @@ Other Bug Fixes - Remove ``__index__`` dunder method call from ``unnecessary-dunder-call`` check. - Closes #6795 (`#6795 <https://github.com/PyCQA/pylint/issues/6795>`_) + Closes #6795 (`#6795 <https://github.com/pylint-dev/pylint/issues/6795>`_) - Fixed a multi-processing crash that prevents using any more than 1 thread on MacOS. @@ -249,7 +249,7 @@ Other Bug Fixes when attempting to serialise the linter object for multi-processing use. - Closes #7635. (`#7635 <https://github.com/PyCQA/pylint/issues/7635>`_) + Closes #7635. (`#7635 <https://github.com/pylint-dev/pylint/issues/7635>`_) @@ -258,11 +258,11 @@ Other Changes - Add a keyword-only ``compare_constants`` argument to ``safe_infer``. - Refs #7626 (`#7626 <https://github.com/PyCQA/pylint/issues/7626>`_) + Refs #7626 (`#7626 <https://github.com/pylint-dev/pylint/issues/7626>`_) - Sort ``--generated-rcfile`` output. - Refs #7655 (`#7655 <https://github.com/PyCQA/pylint/issues/7655>`_) + Refs #7655 (`#7655 <https://github.com/pylint-dev/pylint/issues/7655>`_) What's new in Pylint 2.15.4? @@ -277,7 +277,7 @@ False Positives Fixed ``__anext__``. Also only emit the warning when ``py-version`` >= 3.10. - Closes #7529 (`#7529 <https://github.com/PyCQA/pylint/issues/7529>`_) + Closes #7529 (`#7529 <https://github.com/pylint-dev/pylint/issues/7529>`_) @@ -286,39 +286,39 @@ Other Bug Fixes - Fix bug in detecting ``unused-variable`` when iterating on variable. - Closes #3044 (`#3044 <https://github.com/PyCQA/pylint/issues/3044>`_) + Closes #3044 (`#3044 <https://github.com/pylint-dev/pylint/issues/3044>`_) - Fixed handling of ``--`` as separator between positional arguments and flags. This was not actually fixed in 2.14.5. Closes #7003, Refs #7096 (`#7003 - <https://github.com/PyCQA/pylint/issues/7003>`_) + <https://github.com/pylint-dev/pylint/issues/7003>`_) - Report ``no-self-argument`` rather than ``no-method-argument`` for methods with variadic arguments. - Closes #7507 (`#7507 <https://github.com/PyCQA/pylint/issues/7507>`_) + Closes #7507 (`#7507 <https://github.com/pylint-dev/pylint/issues/7507>`_) - Fixed an issue where ``syntax-error`` couldn't be raised on files with invalid encodings. - Closes #7522 (`#7522 <https://github.com/PyCQA/pylint/issues/7522>`_) + Closes #7522 (`#7522 <https://github.com/pylint-dev/pylint/issues/7522>`_) - Fix false positive for ``redefined-outer-name`` when aliasing ``typing`` e.g. as ``t`` and guarding imports under ``t.TYPE_CHECKING``. - Closes #7524 (`#7524 <https://github.com/PyCQA/pylint/issues/7524>`_) + Closes #7524 (`#7524 <https://github.com/pylint-dev/pylint/issues/7524>`_) - Fixed a crash of the ``modified_iterating`` checker when iterating on a set defined as a class attribute. - Closes #7528 (`#7528 <https://github.com/PyCQA/pylint/issues/7528>`_) + Closes #7528 (`#7528 <https://github.com/pylint-dev/pylint/issues/7528>`_) - Fix bug in scanning of names inside arguments to ``typing.Literal``. See https://peps.python.org/pep-0586/#literals-enums-and-forward-references for details. - Refs #3299 (`#3299 <https://github.com/PyCQA/pylint/issues/3299>`_) + Refs #3299 (`#3299 <https://github.com/pylint-dev/pylint/issues/3299>`_) Other Changes @@ -327,7 +327,7 @@ Other Changes - Add method name to the error messages of ``no-method-argument`` and ``no-self-argument``. - Closes #7507 (`#7507 <https://github.com/PyCQA/pylint/issues/7507>`_) + Closes #7507 (`#7507 <https://github.com/pylint-dev/pylint/issues/7507>`_) What's new in Pylint 2.15.3? @@ -337,23 +337,23 @@ Release date: 2022-09-19 - Fixed a crash in the ``unhashable-member`` checker when using a ``lambda`` as a dict key. - Closes #7453 (`#7453 <https://github.com/PyCQA/pylint/issues/7453>`_) + Closes #7453 (`#7453 <https://github.com/pylint-dev/pylint/issues/7453>`_) - Fix a crash in the ``modified-iterating-dict`` checker involving instance attributes. - Closes #7461 (`#7461 <https://github.com/PyCQA/pylint/issues/7461>`_) + Closes #7461 (`#7461 <https://github.com/pylint-dev/pylint/issues/7461>`_) - ``invalid-class-object`` does not crash anymore when ``__class__`` is assigned alongside another variable. - Closes #7467 (`#7467 <https://github.com/PyCQA/pylint/issues/7467>`_) + Closes #7467 (`#7467 <https://github.com/pylint-dev/pylint/issues/7467>`_) - Fix false positive for ``global-variable-not-assigned`` when a global variable is re-assigned via an ``ImportFrom`` node. - Closes #4809 (`#4809 <https://github.com/PyCQA/pylint/issues/4809>`_) + Closes #4809 (`#4809 <https://github.com/pylint-dev/pylint/issues/4809>`_) - Fix false positive for ``undefined-loop-variable`` in ``for-else`` loops that use a function having a return type annotation of ``NoReturn`` or ``Never``. - Closes #7311 (`#7311 <https://github.com/PyCQA/pylint/issues/7311>`_) + Closes #7311 (`#7311 <https://github.com/pylint-dev/pylint/issues/7311>`_) - ``--help-msg`` now accepts a comma-separated list of message IDs again. - Closes #7471 (`#7471 <https://github.com/PyCQA/pylint/issues/7471>`_) + Closes #7471 (`#7471 <https://github.com/pylint-dev/pylint/issues/7471>`_) What's new in Pylint 2.15.2? ---------------------------- @@ -366,42 +366,42 @@ Release date: 2022-09-07 change, it would silently fail to register the plugin for use, but would load any configuration, which could have unintended effects. - Fixes part of #7264. (`#7264 <https://github.com/PyCQA/pylint/issues/7264>`_) + Fixes part of #7264. (`#7264 <https://github.com/pylint-dev/pylint/issues/7264>`_) - Fix ``used-before-assignment`` for functions/classes defined in type checking guard. - Closes #7368 (`#7368 <https://github.com/PyCQA/pylint/issues/7368>`_) + Closes #7368 (`#7368 <https://github.com/pylint-dev/pylint/issues/7368>`_) - Update ``modified_iterating`` checker to fix a crash with ``for`` loops on empty list. - Closes #7380 (`#7380 <https://github.com/PyCQA/pylint/issues/7380>`_) + Closes #7380 (`#7380 <https://github.com/pylint-dev/pylint/issues/7380>`_) - The ``docparams`` extension now considers typing in Numpy style docstrings as "documentation" for the ``missing-param-doc`` message. - Refs #7398 (`#7398 <https://github.com/PyCQA/pylint/issues/7398>`_) + Refs #7398 (`#7398 <https://github.com/pylint-dev/pylint/issues/7398>`_) - Fix false positive for ``unused-variable`` and ``unused-import`` when a name is only used in a string literal type annotation. - Closes #3299 (`#3299 <https://github.com/PyCQA/pylint/issues/3299>`_) + Closes #3299 (`#3299 <https://github.com/pylint-dev/pylint/issues/3299>`_) - Fix false positive for ``too-many-function-args`` when a function call is assigned to a class attribute inside the class where the function is defined. - Closes #6592 (`#6592 <https://github.com/PyCQA/pylint/issues/6592>`_) + Closes #6592 (`#6592 <https://github.com/pylint-dev/pylint/issues/6592>`_) - Fix ``used-before-assignment`` for functions/classes defined in type checking guard. - Closes #7368 (`#7368 <https://github.com/PyCQA/pylint/issues/7368>`_) + Closes #7368 (`#7368 <https://github.com/pylint-dev/pylint/issues/7368>`_) - Fix ignored files being linted when passed on stdin. - Closes #4354 (`#4354 <https://github.com/PyCQA/pylint/issues/4354>`_) + Closes #4354 (`#4354 <https://github.com/pylint-dev/pylint/issues/4354>`_) - ``missing-return-doc``, ``missing-raises-doc`` and ``missing-yields-doc`` now respect the ``no-docstring-rgx`` option. - Closes #4743 (`#4743 <https://github.com/PyCQA/pylint/issues/4743>`_) + Closes #4743 (`#4743 <https://github.com/pylint-dev/pylint/issues/4743>`_) - Don't crash on ``OSError`` in config file discovery. - Closes #7169 (`#7169 <https://github.com/PyCQA/pylint/issues/7169>`_) + Closes #7169 (`#7169 <https://github.com/pylint-dev/pylint/issues/7169>`_) - ``disable-next`` is now correctly scoped to only the succeeding line. - Closes #7401 (`#7401 <https://github.com/PyCQA/pylint/issues/7401>`_) + Closes #7401 (`#7401 <https://github.com/pylint-dev/pylint/issues/7401>`_) - Update ``modified_iterating`` checker to fix a crash with ``for`` loops on empty list. - Closes #7380 (`#7380 <https://github.com/PyCQA/pylint/issues/7380>`_) + Closes #7380 (`#7380 <https://github.com/pylint-dev/pylint/issues/7380>`_) What's new in Pylint 2.15.1? ---------------------------- @@ -418,7 +418,7 @@ New Checks - Added new checker ``missing-timeout`` to warn of default timeout values that could cause a program to be hanging indefinitely. - Refs #6780 (`#6780 <https://github.com/PyCQA/pylint/issues/6780>`_) + Refs #6780 (`#6780 <https://github.com/pylint-dev/pylint/issues/6780>`_) False Positives Fixed @@ -426,39 +426,39 @@ False Positives Fixed - Don't report ``super-init-not-called`` for abstract ``__init__`` methods. - Closes #3975 (`#3975 <https://github.com/PyCQA/pylint/issues/3975>`_) + Closes #3975 (`#3975 <https://github.com/pylint-dev/pylint/issues/3975>`_) - Don't report ``unsupported-binary-operation`` on Python <= 3.9 when using the ``|`` operator with types, if one has a metaclass that overloads ``__or__`` or ``__ror__`` as appropriate. - Closes #4951 (`#4951 <https://github.com/PyCQA/pylint/issues/4951>`_) + Closes #4951 (`#4951 <https://github.com/pylint-dev/pylint/issues/4951>`_) - Don't report ``no-value-for-parameter`` for dataclasses fields annotated with ``KW_ONLY``. - Closes #5767 (`#5767 <https://github.com/PyCQA/pylint/issues/5767>`_) + Closes #5767 (`#5767 <https://github.com/pylint-dev/pylint/issues/5767>`_) - Fixed inference of ``Enums`` when they are imported under an alias. - Closes #5776 (`#5776 <https://github.com/PyCQA/pylint/issues/5776>`_) + Closes #5776 (`#5776 <https://github.com/pylint-dev/pylint/issues/5776>`_) - Prevent false positives when accessing ``PurePath.parents`` by index (not slice) on Python 3.10+. - Closes #5832 (`#5832 <https://github.com/PyCQA/pylint/issues/5832>`_) + Closes #5832 (`#5832 <https://github.com/pylint-dev/pylint/issues/5832>`_) - ``unnecessary-list-index-lookup`` is now more conservative to avoid potential false positives. - Closes #6896 (`#6896 <https://github.com/PyCQA/pylint/issues/6896>`_) + Closes #6896 (`#6896 <https://github.com/pylint-dev/pylint/issues/6896>`_) - Fix double emitting ``trailing-whitespace`` for multi-line docstrings. - Closes #6936 (`#6936 <https://github.com/PyCQA/pylint/issues/6936>`_) + Closes #6936 (`#6936 <https://github.com/pylint-dev/pylint/issues/6936>`_) - ``import-error`` now correctly checks for ``contextlib.suppress`` guards on import statements. - Closes #7270 (`#7270 <https://github.com/PyCQA/pylint/issues/7270>`_) + Closes #7270 (`#7270 <https://github.com/pylint-dev/pylint/issues/7270>`_) - Fix false positive for `no-self-argument`/`no-method-argument` when a staticmethod is applied to a function but uses a different name. - Closes #7300 (`#7300 <https://github.com/PyCQA/pylint/issues/7300>`_) + Closes #7300 (`#7300 <https://github.com/pylint-dev/pylint/issues/7300>`_) - Fix `undefined-loop-variable` with `break` and `continue` statements in `else` blocks. - Refs #7311 (`#7311 <https://github.com/PyCQA/pylint/issues/7311>`_) + Refs #7311 (`#7311 <https://github.com/pylint-dev/pylint/issues/7311>`_) - Improve default TypeVar name regex. Disallow names prefixed with ``T``. E.g. use ``AnyStrT`` instead of ``TAnyStr``. - Refs #7322 (`#7322 <https://github.com/PyCQA/pylint/issues/7322>`_`) + Refs #7322 (`#7322 <https://github.com/pylint-dev/pylint/issues/7322>`_`) False Negatives Fixed @@ -466,32 +466,32 @@ False Negatives Fixed - Emit ``used-before-assignment`` when relying on a name that is reimported later in a function. - Closes #4624 (`#4624 <https://github.com/PyCQA/pylint/issues/4624>`_) + Closes #4624 (`#4624 <https://github.com/pylint-dev/pylint/issues/4624>`_) - Emit ``used-before-assignment`` for self-referencing named expressions (``:=``) lacking prior assignments. - Closes #5653 (`#5653 <https://github.com/PyCQA/pylint/issues/5653>`_) + Closes #5653 (`#5653 <https://github.com/pylint-dev/pylint/issues/5653>`_) - Emit ``used-before-assignment`` for self-referencing assignments under if conditions. - Closes #6643 (`#6643 <https://github.com/PyCQA/pylint/issues/6643>`_) + Closes #6643 (`#6643 <https://github.com/pylint-dev/pylint/issues/6643>`_) - Emit ``modified-iterating-list`` and analogous messages for dicts and sets when iterating literals, or when using the ``del`` keyword. - Closes #6648 (`#6648 <https://github.com/PyCQA/pylint/issues/6648>`_) + Closes #6648 (`#6648 <https://github.com/pylint-dev/pylint/issues/6648>`_) - Emit ``used-before-assignment`` when calling nested functions before assignment. - Closes #6812 (`#6812 <https://github.com/PyCQA/pylint/issues/6812>`_) + Closes #6812 (`#6812 <https://github.com/pylint-dev/pylint/issues/6812>`_) - Emit ``nonlocal-without-binding`` when a nonlocal name has been assigned at a later point in the same scope. - Closes #6883 (`#6883 <https://github.com/PyCQA/pylint/issues/6883>`_) + Closes #6883 (`#6883 <https://github.com/pylint-dev/pylint/issues/6883>`_) - Emit ``using-constant-test`` when testing the truth value of a variable or call result holding a generator. - Closes #6909 (`#6909 <https://github.com/PyCQA/pylint/issues/6909>`_) + Closes #6909 (`#6909 <https://github.com/pylint-dev/pylint/issues/6909>`_) - Rename ``unhashable-dict-key`` to ``unhashable-member`` and emit when creating sets and dicts, not just when accessing dicts. - Closes #7034, Closes #7055 (`#7034 <https://github.com/PyCQA/pylint/issues/7034>`_) + Closes #7034, Closes #7055 (`#7034 <https://github.com/pylint-dev/pylint/issues/7034>`_) Other Bug Fixes @@ -499,30 +499,30 @@ Other Bug Fixes - Fix a failure to lint packages with ``__init__.py`` contained in directories lacking ``__init__.py``. - Closes #1667 (`#1667 <https://github.com/PyCQA/pylint/issues/1667>`_) + Closes #1667 (`#1667 <https://github.com/pylint-dev/pylint/issues/1667>`_) - Fixed a syntax-error crash that was not handled properly when the declared encoding of a file was ``utf-9``. - Closes #3860 (`#3860 <https://github.com/PyCQA/pylint/issues/3860>`_) + Closes #3860 (`#3860 <https://github.com/pylint-dev/pylint/issues/3860>`_) - Fix a crash in the ``not-callable`` check when there is ambiguity whether an instance is being incorrectly provided to ``__new__()``. - Closes #7109 (`#7109 <https://github.com/PyCQA/pylint/issues/7109>`_) + Closes #7109 (`#7109 <https://github.com/pylint-dev/pylint/issues/7109>`_) - Fix crash when regex option raises a `re.error` exception. - Closes #7202 (`#7202 <https://github.com/PyCQA/pylint/issues/7202>`_) + Closes #7202 (`#7202 <https://github.com/pylint-dev/pylint/issues/7202>`_) - Fix `undefined-loop-variable` from walrus in comprehension test. - Closes #7222 (`#7222 <https://github.com/PyCQA/pylint/issues/7222>`_) + Closes #7222 (`#7222 <https://github.com/pylint-dev/pylint/issues/7222>`_) - Check for `<cwd>` before removing first item from `sys.path` in `modify_sys_path`. - Closes #7231 (`#7231 <https://github.com/PyCQA/pylint/issues/7231>`_) + Closes #7231 (`#7231 <https://github.com/pylint-dev/pylint/issues/7231>`_) - Fix sys.path pollution in parallel mode. - Closes #7246 (`#7246 <https://github.com/PyCQA/pylint/issues/7246>`_) + Closes #7246 (`#7246 <https://github.com/pylint-dev/pylint/issues/7246>`_) - Prevent `useless-parent-delegation` for delegating to a builtin written in C (e.g. `Exception.__init__`) with non-self arguments. - Closes #7319 (`#7319 <https://github.com/PyCQA/pylint/issues/7319>`_) + Closes #7319 (`#7319 <https://github.com/pylint-dev/pylint/issues/7319>`_) Other Changes @@ -530,23 +530,23 @@ Other Changes - ``bad-exception-context`` has been renamed to ``bad-exception-cause`` as it is about the cause and not the context. - Closes #3694 (`#3694 <https://github.com/PyCQA/pylint/issues/3694>`_) + Closes #3694 (`#3694 <https://github.com/pylint-dev/pylint/issues/3694>`_) - The message for ``literal-comparison`` is now more explicit about the problem and the solution. - Closes #5237 (`#5237 <https://github.com/PyCQA/pylint/issues/5237>`_) + Closes #5237 (`#5237 <https://github.com/pylint-dev/pylint/issues/5237>`_) - ``useless-super-delegation`` has been renamed to ``useless-parent-delegation`` in order to be more generic. - Closes #6953 (`#6953 <https://github.com/PyCQA/pylint/issues/6953>`_) + Closes #6953 (`#6953 <https://github.com/pylint-dev/pylint/issues/6953>`_) - Pylint now uses ``towncrier`` for changelog generation. - Refs #6974 (`#6974 <https://github.com/PyCQA/pylint/issues/6974>`_) + Refs #6974 (`#6974 <https://github.com/pylint-dev/pylint/issues/6974>`_) - Update ``astroid`` to 2.12. - Refs #7153 (`#7153 <https://github.com/PyCQA/pylint/issues/7153>`_) + Refs #7153 (`#7153 <https://github.com/pylint-dev/pylint/issues/7153>`_) - Fix crash when a type-annotated `__slots__` with no value is declared. - Closes #7280 (`#7280 <https://github.com/PyCQA/pylint/issues/7280>`_) + Closes #7280 (`#7280 <https://github.com/pylint-dev/pylint/issues/7280>`_) Internal Changes @@ -556,17 +556,17 @@ Internal Changes output was impossible to parse. Instead of raising an error we raise a warning message and let the functional test fail with a default value. - Refs #6891 (`#6891 <https://github.com/PyCQA/pylint/issues/6891>`_) + Refs #6891 (`#6891 <https://github.com/pylint-dev/pylint/issues/6891>`_) - ``pylint.testutils.primer`` is now a private API. - Refs #6905 (`#6905 <https://github.com/PyCQA/pylint/issues/6905>`_) + Refs #6905 (`#6905 <https://github.com/pylint-dev/pylint/issues/6905>`_) - We changed the way we handle the changelog internally by using towncrier. If you're a contributor you won't have to fix merge conflicts in the changelog anymore. - Closes #6974 (`#6974 <https://github.com/PyCQA/pylint/issues/6974>`_) + Closes #6974 (`#6974 <https://github.com/pylint-dev/pylint/issues/6974>`_) - Pylint is now using Scorecards to implement security recommendations from the `OpenSSF <https://openssf.org/>`_. This is done in order to secure our supply chains using a combination of automated tooling and best practices, most of which were already implemented before. - Refs #7267 (`#7267 <https://github.com/PyCQA/pylint/issues/7267>`_) + Refs #7267 (`#7267 <https://github.com/pylint-dev/pylint/issues/7267>`_) diff --git a/doc/whatsnew/2/2.16/index.rst b/doc/whatsnew/2/2.16/index.rst index 605b9b18b..3a9731ce3 100644 --- a/doc/whatsnew/2/2.16/index.rst +++ b/doc/whatsnew/2/2.16/index.rst @@ -24,7 +24,7 @@ If you want to benefit from all the new checks load the following plugins:: pylint.extensions.magic_value, We still welcome any community effort to help review, integrate, and add good/bad examples to the doc for -<https://github.com/PyCQA/pylint/issues/5953>`_. This should be doable without any ``pylint`` or ``astroid`` +<https://github.com/pylint-dev/pylint/issues/5953>`_. This should be doable without any ``pylint`` or ``astroid`` knowledge, so this is the perfect entrypoint if you want to contribute to ``pylint`` or open source without any experience with our code! @@ -43,7 +43,7 @@ False Positives Fixed - Fix false positive for isinstance-second-argument-not-valid-type with union types. - Closes #8205 (`#8205 <https://github.com/PyCQA/pylint/issues/8205>`_) + Closes #8205 (`#8205 <https://github.com/pylint-dev/pylint/issues/8205>`_) What's new in Pylint 2.16.3? @@ -57,7 +57,7 @@ False Positives Fixed - Fix false positive for ``wrong-spelling-in-comment`` with class names in a python 2 type comment. - Closes #8370 (`#8370 <https://github.com/PyCQA/pylint/issues/8370>`_) + Closes #8370 (`#8370 <https://github.com/pylint-dev/pylint/issues/8370>`_) @@ -67,7 +67,7 @@ Other Bug Fixes - Prevent emitting ``invalid-name`` for the line on which a ``global`` statement is declared. - Closes #8307 (`#8307 <https://github.com/PyCQA/pylint/issues/8307>`_) + Closes #8307 (`#8307 <https://github.com/pylint-dev/pylint/issues/8307>`_) What's new in Pylint 2.16.2? @@ -80,7 +80,7 @@ New Features - Add `--version` option to `pyreverse`. - Refs #7851 (`#7851 <https://github.com/PyCQA/pylint/issues/7851>`_) + Refs #7851 (`#7851 <https://github.com/pylint-dev/pylint/issues/7851>`_) @@ -90,12 +90,12 @@ False Positives Fixed - Fix false positive for ``used-before-assignment`` when ``typing.TYPE_CHECKING`` is used with if/elif/else blocks. - Closes #7574 (`#7574 <https://github.com/PyCQA/pylint/issues/7574>`_) + Closes #7574 (`#7574 <https://github.com/pylint-dev/pylint/issues/7574>`_) - Fix false positive for ``used-before-assignment`` for named expressions appearing after the first element in a list, tuple, or set. - Closes #8252 (`#8252 <https://github.com/PyCQA/pylint/issues/8252>`_) + Closes #8252 (`#8252 <https://github.com/pylint-dev/pylint/issues/8252>`_) @@ -105,23 +105,23 @@ Other Bug Fixes - Fix ``used-before-assignment`` false positive when the walrus operator is used with a ternary operator in dictionary key/value initialization. - Closes #8125 (`#8125 <https://github.com/PyCQA/pylint/issues/8125>`_) + Closes #8125 (`#8125 <https://github.com/pylint-dev/pylint/issues/8125>`_) - Fix ``no-name-in-module`` false positive raised when a package defines a variable with the same name as one of its submodules. - Closes #8148 (`#8148 <https://github.com/PyCQA/pylint/issues/8148>`_) + Closes #8148 (`#8148 <https://github.com/pylint-dev/pylint/issues/8148>`_) - Fix ``nested-min-max`` suggestion message to indicate it's possible to splat iterable objects. - Closes #8168 (`#8168 <https://github.com/PyCQA/pylint/issues/8168>`_) + Closes #8168 (`#8168 <https://github.com/pylint-dev/pylint/issues/8168>`_) - Fix a crash happening when a class attribute was negated in the start argument of an enumerate. - Closes #8207 (`#8207 <https://github.com/PyCQA/pylint/issues/8207>`_) + Closes #8207 (`#8207 <https://github.com/pylint-dev/pylint/issues/8207>`_) What's new in Pylint 2.16.1? @@ -135,7 +135,7 @@ Other Bug Fixes - Fix a crash happening for python interpreter < 3.9 following a failed typing update. - Closes #8161 (`#8161 <https://github.com/PyCQA/pylint/issues/8161>`_) + Closes #8161 (`#8161 <https://github.com/pylint-dev/pylint/issues/8161>`_) What's new in Pylint 2.16.0? @@ -156,7 +156,7 @@ Changes requiring user actions will now have to add ``accept-no-raise-doc=no`` in your configuration to keep the same behavior. - Closes #7208 (`#7208 <https://github.com/PyCQA/pylint/issues/7208>`_) + Closes #7208 (`#7208 <https://github.com/pylint-dev/pylint/issues/7208>`_) @@ -167,26 +167,26 @@ New Features ``--output-format=no-header``, it will not include the module name in the output. - Closes #5362 (`#5362 <https://github.com/PyCQA/pylint/issues/5362>`_) + Closes #5362 (`#5362 <https://github.com/pylint-dev/pylint/issues/5362>`_) - Added configuration option ``clear-cache-post-run`` to support server-like usage. Use this flag if you expect the linted files to be altered between runs. - Refs #5401 (`#5401 <https://github.com/PyCQA/pylint/issues/5401>`_) + Refs #5401 (`#5401 <https://github.com/pylint-dev/pylint/issues/5401>`_) - Add ``--allow-reexport-from-package`` option to configure the ``useless-import-alias`` check not to emit a warning if a name is reexported from a package. - Closes #6006 (`#6006 <https://github.com/PyCQA/pylint/issues/6006>`_) + Closes #6006 (`#6006 <https://github.com/pylint-dev/pylint/issues/6006>`_) - Update ``pyreverse`` to differentiate between aggregations and compositions. ``pyreverse`` checks if it's an Instance or a Call of an object via method parameters (via type hints) to decide if it's a composition or an aggregation. - Refs #6543 (`#6543 <https://github.com/PyCQA/pylint/issues/6543>`_) + Refs #6543 (`#6543 <https://github.com/pylint-dev/pylint/issues/6543>`_) @@ -196,23 +196,23 @@ New Checks - Adds a ``pointless-exception-statement`` check that emits a warning when an Exception is created and not assigned, raised or returned. - Refs #3110 (`#3110 <https://github.com/PyCQA/pylint/issues/3110>`_) + Refs #3110 (`#3110 <https://github.com/pylint-dev/pylint/issues/3110>`_) - Add a ``shadowed-import`` message for aliased imports. - Closes #4836 (`#4836 <https://github.com/PyCQA/pylint/issues/4836>`_) + Closes #4836 (`#4836 <https://github.com/pylint-dev/pylint/issues/4836>`_) - Add new check called ``unbalanced-dict-unpacking`` to check for unbalanced dict unpacking in assignment and for loops. - Closes #5797 (`#5797 <https://github.com/PyCQA/pylint/issues/5797>`_) + Closes #5797 (`#5797 <https://github.com/pylint-dev/pylint/issues/5797>`_) - Add new checker ``positional-only-arguments-expected`` to check for cases when positional-only arguments have been passed as keyword arguments. - Closes #6489 (`#6489 <https://github.com/PyCQA/pylint/issues/6489>`_) + Closes #6489 (`#6489 <https://github.com/pylint-dev/pylint/issues/6489>`_) - Added ``singledispatch-method`` which informs that ``@singledispatch`` should decorate functions and not class/instance methods. @@ -220,42 +220,42 @@ New Checks ``@singledispatchmethod`` should decorate class/instance methods and not functions. - Closes #6917 (`#6917 <https://github.com/PyCQA/pylint/issues/6917>`_) + Closes #6917 (`#6917 <https://github.com/pylint-dev/pylint/issues/6917>`_) - Rename ``broad-except`` to ``broad-exception-caught`` and add new checker ``broad-exception-raised`` which will warn if general exceptions ``BaseException`` or ``Exception`` are raised. - Closes #7494 (`#7494 <https://github.com/PyCQA/pylint/issues/7494>`_) + Closes #7494 (`#7494 <https://github.com/pylint-dev/pylint/issues/7494>`_) - Added ``nested-min-max`` which flags ``min(1, min(2, 3))`` to simplify to ``min(1, 2, 3)``. - Closes #7546 (`#7546 <https://github.com/PyCQA/pylint/issues/7546>`_) + Closes #7546 (`#7546 <https://github.com/pylint-dev/pylint/issues/7546>`_) - Extended ``use-dict-literal`` to also warn about call to ``dict()`` when passing keyword arguments. - Closes #7690 (`#7690 <https://github.com/PyCQA/pylint/issues/7690>`_) + Closes #7690 (`#7690 <https://github.com/pylint-dev/pylint/issues/7690>`_) - Add ``named-expr-without-context`` check to emit a warning if a named expression is used outside a context like ``if``, ``for``, ``while``, or a comprehension. - Refs #7760 (`#7760 <https://github.com/PyCQA/pylint/issues/7760>`_) + Refs #7760 (`#7760 <https://github.com/pylint-dev/pylint/issues/7760>`_) - Add ``invalid-slice-step`` check to warn about a slice step value of ``0`` for common builtin sequences. - Refs #7762 (`#7762 <https://github.com/PyCQA/pylint/issues/7762>`_) + Refs #7762 (`#7762 <https://github.com/pylint-dev/pylint/issues/7762>`_) - Add ``consider-refactoring-into-while-condition`` check to recommend refactoring when a while loop is defined with a constant condition with an immediate ``if`` statement to check for ``break`` condition as a first statement. - Closes #8015 (`#8015 <https://github.com/PyCQA/pylint/issues/8015>`_) + Closes #8015 (`#8015 <https://github.com/pylint-dev/pylint/issues/8015>`_) @@ -266,13 +266,13 @@ Extensions dictionary immediately after the dictionary was created. - Closes #2876 (`#2876 <https://github.com/PyCQA/pylint/issues/2876>`_) + Closes #2876 (`#2876 <https://github.com/pylint-dev/pylint/issues/2876>`_) - Added ``bad-dunder-name`` extension check, which flags bad or misspelled dunder methods. You can use the ``good-dunder-names`` option to allow specific dunder names. - Closes #3038 (`#3038 <https://github.com/PyCQA/pylint/issues/3038>`_) + Closes #3038 (`#3038 <https://github.com/pylint-dev/pylint/issues/3038>`_) - Added ``consider-using-augmented-assign`` check for ``CodeStyle`` extension which flags ``x = x + 1`` to simplify to ``x += 1``. @@ -280,20 +280,20 @@ Extensions with ``load-plugins=pylint.extensions.code_style`` and add ``consider-using-augmented-assign`` in the ``enable`` option. - Closes #3391 (`#3391 <https://github.com/PyCQA/pylint/issues/3391>`_) + Closes #3391 (`#3391 <https://github.com/pylint-dev/pylint/issues/3391>`_) - Add ``magic-number`` plugin checker for comparison with constants instead of named constants or enums. You can use it with ``--load-plugins=pylint.extensions.magic_value``. - Closes #7281 (`#7281 <https://github.com/PyCQA/pylint/issues/7281>`_) + Closes #7281 (`#7281 <https://github.com/pylint-dev/pylint/issues/7281>`_) - Add ``redundant-typehint-argument`` message for `typing` plugin for duplicate assign typehints. Enable the plugin to enable the message with: ``--load-plugins=pylint.extensions.typing``. - Closes #7636 (`#7636 <https://github.com/PyCQA/pylint/issues/7636>`_) + Closes #7636 (`#7636 <https://github.com/pylint-dev/pylint/issues/7636>`_) @@ -303,160 +303,160 @@ False Positives Fixed - Fix false positive for ``unused-variable`` and ``unused-import`` when a name is only used in a string literal type annotation. - Closes #3299 (`#3299 <https://github.com/PyCQA/pylint/issues/3299>`_) + Closes #3299 (`#3299 <https://github.com/pylint-dev/pylint/issues/3299>`_) - Document a known false positive for ``useless-suppression`` when disabling ``line-too-long`` in a module with only comments and no code. - Closes #3368 (`#3368 <https://github.com/PyCQA/pylint/issues/3368>`_) + Closes #3368 (`#3368 <https://github.com/pylint-dev/pylint/issues/3368>`_) - ``trailing-whitespaces`` is no longer reported within strings. - Closes #3822 (`#3822 <https://github.com/PyCQA/pylint/issues/3822>`_) + Closes #3822 (`#3822 <https://github.com/pylint-dev/pylint/issues/3822>`_) - Fix false positive for ``global-variable-not-assigned`` when a global variable is re-assigned via an ``ImportFrom`` node. - Closes #4809 (`#4809 <https://github.com/PyCQA/pylint/issues/4809>`_) + Closes #4809 (`#4809 <https://github.com/pylint-dev/pylint/issues/4809>`_) - Fix false positive for ``use-maxsplit-arg`` with custom split method. - Closes #4857 (`#4857 <https://github.com/PyCQA/pylint/issues/4857>`_) + Closes #4857 (`#4857 <https://github.com/pylint-dev/pylint/issues/4857>`_) - Fix ``logging-fstring-interpolation`` false positive raised when logging and f-string with ``%s`` formatting. - Closes #4984 (`#4984 <https://github.com/PyCQA/pylint/issues/4984>`_) + Closes #4984 (`#4984 <https://github.com/pylint-dev/pylint/issues/4984>`_) - Fix false-positive for ``used-before-assignment`` in pattern matching with a guard. - Closes #5327 (`#5327 <https://github.com/PyCQA/pylint/issues/5327>`_) + Closes #5327 (`#5327 <https://github.com/pylint-dev/pylint/issues/5327>`_) - Fix ``use-sequence-for-iteration`` when unpacking a set with ``*``. - Closes #5788 (`#5788 <https://github.com/PyCQA/pylint/issues/5788>`_) + Closes #5788 (`#5788 <https://github.com/pylint-dev/pylint/issues/5788>`_) - Fix ``deprecated-method`` false positive when alias for method is similar to name of deprecated method. - Closes #5886 (`#5886 <https://github.com/PyCQA/pylint/issues/5886>`_) + Closes #5886 (`#5886 <https://github.com/pylint-dev/pylint/issues/5886>`_) - Fix false positive ``assigning-non-slot`` when a class attribute is re-assigned. - Closes #6001 (`#6001 <https://github.com/PyCQA/pylint/issues/6001>`_) + Closes #6001 (`#6001 <https://github.com/pylint-dev/pylint/issues/6001>`_) - Fix false positive for ``too-many-function-args`` when a function call is assigned to a class attribute inside the class where the function is defined. - Closes #6592 (`#6592 <https://github.com/PyCQA/pylint/issues/6592>`_) + Closes #6592 (`#6592 <https://github.com/pylint-dev/pylint/issues/6592>`_) - Fixes false positive ``abstract-method`` on Protocol classes. - Closes #7209 (`#7209 <https://github.com/PyCQA/pylint/issues/7209>`_) + Closes #7209 (`#7209 <https://github.com/pylint-dev/pylint/issues/7209>`_) - Pylint now understands the ``kw_only`` keyword argument for ``dataclass``. Closes #7290, closes #6550, closes #5857 (`#7290 - <https://github.com/PyCQA/pylint/issues/7290>`_) + <https://github.com/pylint-dev/pylint/issues/7290>`_) - Fix false positive for ``undefined-loop-variable`` in ``for-else`` loops that use a function having a return type annotation of ``NoReturn`` or ``Never``. - Closes #7311 (`#7311 <https://github.com/PyCQA/pylint/issues/7311>`_) + Closes #7311 (`#7311 <https://github.com/pylint-dev/pylint/issues/7311>`_) - Fix ``used-before-assignment`` for functions/classes defined in type checking guard. - Closes #7368 (`#7368 <https://github.com/PyCQA/pylint/issues/7368>`_) + Closes #7368 (`#7368 <https://github.com/pylint-dev/pylint/issues/7368>`_) - Fix false positive for ``unhashable-member`` when subclassing ``dict`` and using the subclass as a dictionary key. - Closes #7501 (`#7501 <https://github.com/PyCQA/pylint/issues/7501>`_) + Closes #7501 (`#7501 <https://github.com/pylint-dev/pylint/issues/7501>`_) - Fix the message for ``unnecessary-dunder-call`` for ``__aiter__`` and ``__aneext__``. Also only emit the warning when ``py-version`` >= 3.10. - Closes #7529 (`#7529 <https://github.com/PyCQA/pylint/issues/7529>`_) + Closes #7529 (`#7529 <https://github.com/pylint-dev/pylint/issues/7529>`_) - Fix ``used-before-assignment`` false positive when else branch calls ``sys.exit`` or similar terminating functions. - Closes #7563 (`#7563 <https://github.com/PyCQA/pylint/issues/7563>`_) + Closes #7563 (`#7563 <https://github.com/pylint-dev/pylint/issues/7563>`_) - Fix a false positive for ``used-before-assignment`` for imports guarded by ``typing.TYPE_CHECKING`` later used in variable annotations. - Closes #7609 (`#7609 <https://github.com/PyCQA/pylint/issues/7609>`_) + Closes #7609 (`#7609 <https://github.com/pylint-dev/pylint/issues/7609>`_) - Fix a false positive for ``simplify-boolean-expression`` when multiple values are inferred for a constant. - Closes #7626 (`#7626 <https://github.com/PyCQA/pylint/issues/7626>`_) + Closes #7626 (`#7626 <https://github.com/pylint-dev/pylint/issues/7626>`_) - ``unnecessary-list-index-lookup`` will not be wrongly emitted if ``enumerate`` is called with ``start``. - Closes #7682 (`#7682 <https://github.com/PyCQA/pylint/issues/7682>`_) + Closes #7682 (`#7682 <https://github.com/pylint-dev/pylint/issues/7682>`_) - Don't warn about ``stop-iteration-return`` when using ``next()`` over ``itertools.cycle``. - Closes #7765 (`#7765 <https://github.com/PyCQA/pylint/issues/7765>`_) + Closes #7765 (`#7765 <https://github.com/pylint-dev/pylint/issues/7765>`_) - Fixes ``used-before-assignment`` false positive when the walrus operator is used in a ternary operator. - Closes #7779 (`#7779 <https://github.com/PyCQA/pylint/issues/7779>`_) + Closes #7779 (`#7779 <https://github.com/pylint-dev/pylint/issues/7779>`_) - Fix ``missing-param-doc`` false positive when function parameter has an escaped underscore. - Closes #7827 (`#7827 <https://github.com/PyCQA/pylint/issues/7827>`_) + Closes #7827 (`#7827 <https://github.com/pylint-dev/pylint/issues/7827>`_) - Fixes ``method-cache-max-size-none`` false positive for methods inheriting from ``Enum``. - Closes #7857 (`#7857 <https://github.com/PyCQA/pylint/issues/7857>`_) + Closes #7857 (`#7857 <https://github.com/pylint-dev/pylint/issues/7857>`_) - ``multiple-statements`` no longer triggers for function stubs using inlined ``...``. - Closes #7860 (`#7860 <https://github.com/PyCQA/pylint/issues/7860>`_) + Closes #7860 (`#7860 <https://github.com/pylint-dev/pylint/issues/7860>`_) - Fix a false positive for ``used-before-assignment`` when a name guarded by ``if TYPE_CHECKING:`` is used as a type annotation in a function body and later re-imported in the same scope. - Closes #7882 (`#7882 <https://github.com/PyCQA/pylint/issues/7882>`_) + Closes #7882 (`#7882 <https://github.com/pylint-dev/pylint/issues/7882>`_) - Prevent ``used-before-assignment`` when imports guarded by ``if TYPE_CHECKING`` are guarded again when used. - Closes #7979 (`#7979 <https://github.com/PyCQA/pylint/issues/7979>`_) + Closes #7979 (`#7979 <https://github.com/pylint-dev/pylint/issues/7979>`_) - Fixes false positive for ``try-except-raise`` with multiple exceptions in one except statement if exception are in different namespace. - Closes #8051 (`#8051 <https://github.com/PyCQA/pylint/issues/8051>`_) + Closes #8051 (`#8051 <https://github.com/pylint-dev/pylint/issues/8051>`_) - Fix ``invalid-name`` errors for ``typing_extension.TypeVar``. - Refs #8089 (`#8089 <https://github.com/PyCQA/pylint/issues/8089>`_) + Refs #8089 (`#8089 <https://github.com/pylint-dev/pylint/issues/8089>`_) - Fix ``no-kwoa`` false positive for context managers. - Closes #8100 (`#8100 <https://github.com/PyCQA/pylint/issues/8100>`_) + Closes #8100 (`#8100 <https://github.com/pylint-dev/pylint/issues/8100>`_) - Fix a false positive for ``redefined-variable-type`` when ``async`` methods are present. - Closes #8120 (`#8120 <https://github.com/PyCQA/pylint/issues/8120>`_) + Closes #8120 (`#8120 <https://github.com/pylint-dev/pylint/issues/8120>`_) @@ -466,31 +466,31 @@ False Negatives Fixed - Code following a call to ``quit``, ``exit``, ``sys.exit`` or ``os._exit`` will be marked as `unreachable`. - Refs #519 (`#519 <https://github.com/PyCQA/pylint/issues/519>`_) + Refs #519 (`#519 <https://github.com/pylint-dev/pylint/issues/519>`_) - Emit ``used-before-assignment`` when function arguments are redefined inside an inner function and accessed there before assignment. - Closes #2374 (`#2374 <https://github.com/PyCQA/pylint/issues/2374>`_) + Closes #2374 (`#2374 <https://github.com/pylint-dev/pylint/issues/2374>`_) - Fix a false negative for ``unused-import`` when one module used an import in a type annotation that was also used in another module. - Closes #4150 (`#4150 <https://github.com/PyCQA/pylint/issues/4150>`_) + Closes #4150 (`#4150 <https://github.com/pylint-dev/pylint/issues/4150>`_) - Flag ``superfluous-parens`` if parentheses are used during string concatenation. - Closes #4792 (`#4792 <https://github.com/PyCQA/pylint/issues/4792>`_) + Closes #4792 (`#4792 <https://github.com/pylint-dev/pylint/issues/4792>`_) - Emit ``used-before-assignment`` when relying on names only defined under conditions always testing false. - Closes #4913 (`#4913 <https://github.com/PyCQA/pylint/issues/4913>`_) + Closes #4913 (`#4913 <https://github.com/pylint-dev/pylint/issues/4913>`_) - ``consider-using-join`` can now be emitted for non-empty string separators. - Closes #6639 (`#6639 <https://github.com/PyCQA/pylint/issues/6639>`_) + Closes #6639 (`#6639 <https://github.com/pylint-dev/pylint/issues/6639>`_) - Emit ``used-before-assignment`` for further imports guarded by ``TYPE_CHECKING`` @@ -500,40 +500,40 @@ False Negatives Fixed ``TYPE_CHECKING`` was imported from ``typing`` under an alias. - Closes #7539 (`#7539 <https://github.com/PyCQA/pylint/issues/7539>`_) + Closes #7539 (`#7539 <https://github.com/pylint-dev/pylint/issues/7539>`_) - Fix a false negative for ``unused-import`` when a constant inside ``typing.Annotated`` was treated as a reference to an import. - Closes #7547 (`#7547 <https://github.com/PyCQA/pylint/issues/7547>`_) + Closes #7547 (`#7547 <https://github.com/pylint-dev/pylint/issues/7547>`_) - ``consider-using-any-or-all`` message will now be raised in cases when boolean is initialized, reassigned during loop, and immediately returned. - Closes #7699 (`#7699 <https://github.com/PyCQA/pylint/issues/7699>`_) + Closes #7699 (`#7699 <https://github.com/pylint-dev/pylint/issues/7699>`_) - Extend ``invalid-slice-index`` to emit an warning for invalid slice indices used with string and byte sequences, and range objects. - Refs #7762 (`#7762 <https://github.com/PyCQA/pylint/issues/7762>`_) + Refs #7762 (`#7762 <https://github.com/pylint-dev/pylint/issues/7762>`_) - Fixes ``unnecessary-list-index-lookup`` false negative when ``enumerate`` is called with ``iterable`` as a kwarg. - Closes #7770 (`#7770 <https://github.com/PyCQA/pylint/issues/7770>`_) + Closes #7770 (`#7770 <https://github.com/pylint-dev/pylint/issues/7770>`_) - ``no-else-return`` or ``no-else-raise`` will be emitted if ``except`` block always returns or raises. - Closes #7788 (`#7788 <https://github.com/PyCQA/pylint/issues/7788>`_) + Closes #7788 (`#7788 <https://github.com/pylint-dev/pylint/issues/7788>`_) - Fix ``dangerous-default-value`` false negative when ``*`` is used. - Closes #7818 (`#7818 <https://github.com/PyCQA/pylint/issues/7818>`_) + Closes #7818 (`#7818 <https://github.com/pylint-dev/pylint/issues/7818>`_) - ``consider-using-with`` now triggers for ``pathlib.Path.open``. - Closes #7964 (`#7964 <https://github.com/PyCQA/pylint/issues/7964>`_) + Closes #7964 (`#7964 <https://github.com/pylint-dev/pylint/issues/7964>`_) @@ -542,81 +542,81 @@ Other Bug Fixes - Fix bug in detecting ``unused-variable`` when iterating on variable. - Closes #3044 (`#3044 <https://github.com/PyCQA/pylint/issues/3044>`_) + Closes #3044 (`#3044 <https://github.com/pylint-dev/pylint/issues/3044>`_) - Fix bug in scanning of names inside arguments to ``typing.Literal``. See https://peps.python.org/pep-0586/#literals-enums-and-forward-references for details. - Refs #3299 (`#3299 <https://github.com/PyCQA/pylint/issues/3299>`_) + Refs #3299 (`#3299 <https://github.com/pylint-dev/pylint/issues/3299>`_) - Update ``disallowed-name`` check to flag module-level variables. - Closes #3701 (`#3701 <https://github.com/PyCQA/pylint/issues/3701>`_) + Closes #3701 (`#3701 <https://github.com/pylint-dev/pylint/issues/3701>`_) - Pylint will no longer deadlock if a parallel job is killed but fail immediately instead. - Closes #3899 (`#3899 <https://github.com/PyCQA/pylint/issues/3899>`_) + Closes #3899 (`#3899 <https://github.com/pylint-dev/pylint/issues/3899>`_) - Fix ignored files being linted when passed on stdin. - Closes #4354 (`#4354 <https://github.com/PyCQA/pylint/issues/4354>`_) + Closes #4354 (`#4354 <https://github.com/pylint-dev/pylint/issues/4354>`_) - Fix ``no-member`` false negative when augmented assign is done manually, without ``+=``. - Closes #4562 (`#4562 <https://github.com/PyCQA/pylint/issues/4562>`_) + Closes #4562 (`#4562 <https://github.com/pylint-dev/pylint/issues/4562>`_) - Any assertion on a populated tuple will now receive a ``assert-on-tuple`` warning. - Closes #4655 (`#4655 <https://github.com/PyCQA/pylint/issues/4655>`_) + Closes #4655 (`#4655 <https://github.com/pylint-dev/pylint/issues/4655>`_) - ``missing-return-doc``, ``missing-raises-doc`` and ``missing-yields-doc`` now respect the ``no-docstring-rgx`` option. - Closes #4743 (`#4743 <https://github.com/PyCQA/pylint/issues/4743>`_) + Closes #4743 (`#4743 <https://github.com/pylint-dev/pylint/issues/4743>`_) - Update ``reimported`` help message for clarity. - Closes #4836 (`#4836 <https://github.com/PyCQA/pylint/issues/4836>`_) + Closes #4836 (`#4836 <https://github.com/pylint-dev/pylint/issues/4836>`_) - ``consider-iterating-dictionary`` will no longer be raised if bitwise operations are used. - Closes #5478 (`#5478 <https://github.com/PyCQA/pylint/issues/5478>`_) + Closes #5478 (`#5478 <https://github.com/pylint-dev/pylint/issues/5478>`_) - Using custom braces in ``msg-template`` will now work properly. - Closes #5636 (`#5636 <https://github.com/PyCQA/pylint/issues/5636>`_) + Closes #5636 (`#5636 <https://github.com/pylint-dev/pylint/issues/5636>`_) - Pylint will now filter duplicates given to it before linting. The output should be the same whether a file is given/discovered multiple times or not. - Closes #6242, #4053 (`#6242 <https://github.com/PyCQA/pylint/issues/6242>`_) + Closes #6242, #4053 (`#6242 <https://github.com/pylint-dev/pylint/issues/6242>`_) - Remove ``__index__`` dunder method call from ``unnecessary-dunder-call`` check. - Closes #6795 (`#6795 <https://github.com/PyCQA/pylint/issues/6795>`_) + Closes #6795 (`#6795 <https://github.com/pylint-dev/pylint/issues/6795>`_) - Fixed handling of ``--`` as separator between positional arguments and flags. This was not actually fixed in 2.14.5. Closes #7003, Refs #7096 (`#7003 - <https://github.com/PyCQA/pylint/issues/7003>`_) + <https://github.com/pylint-dev/pylint/issues/7003>`_) - Don't crash on ``OSError`` in config file discovery. - Closes #7169 (`#7169 <https://github.com/PyCQA/pylint/issues/7169>`_) + Closes #7169 (`#7169 <https://github.com/pylint-dev/pylint/issues/7169>`_) - Messages sent to reporter are now copied so a reporter cannot modify the message sent to other reporters. - Closes #7214 (`#7214 <https://github.com/PyCQA/pylint/issues/7214>`_) + Closes #7214 (`#7214 <https://github.com/pylint-dev/pylint/issues/7214>`_) - Fixed a case where custom plugins specified by command line could silently fail. @@ -628,85 +628,85 @@ Other Bug Fixes change, it would silently fail to register the plugin for use, but would load any configuration, which could have unintended effects. - Fixes part of #7264. (`#7264 <https://github.com/PyCQA/pylint/issues/7264>`_) + Fixes part of #7264. (`#7264 <https://github.com/pylint-dev/pylint/issues/7264>`_) - Update ``modified_iterating`` checker to fix a crash with ``for`` loops on empty list. - Closes #7380 (`#7380 <https://github.com/PyCQA/pylint/issues/7380>`_) + Closes #7380 (`#7380 <https://github.com/pylint-dev/pylint/issues/7380>`_) - Update wording for ``arguments-differ`` and ``arguments-renamed`` to clarify overriding object. - Closes #7390 (`#7390 <https://github.com/PyCQA/pylint/issues/7390>`_) + Closes #7390 (`#7390 <https://github.com/pylint-dev/pylint/issues/7390>`_) - ``disable-next`` is now correctly scoped to only the succeeding line. - Closes #7401 (`#7401 <https://github.com/PyCQA/pylint/issues/7401>`_) + Closes #7401 (`#7401 <https://github.com/pylint-dev/pylint/issues/7401>`_) - Fixed a crash in the ``unhashable-member`` checker when using a ``lambda`` as a dict key. - Closes #7453 (`#7453 <https://github.com/PyCQA/pylint/issues/7453>`_) + Closes #7453 (`#7453 <https://github.com/pylint-dev/pylint/issues/7453>`_) - Add ``mailcap`` to deprecated modules list. - Closes #7457 (`#7457 <https://github.com/PyCQA/pylint/issues/7457>`_) + Closes #7457 (`#7457 <https://github.com/pylint-dev/pylint/issues/7457>`_) - Fix a crash in the ``modified-iterating-dict`` checker involving instance attributes. - Closes #7461 (`#7461 <https://github.com/PyCQA/pylint/issues/7461>`_) + Closes #7461 (`#7461 <https://github.com/pylint-dev/pylint/issues/7461>`_) - ``invalid-class-object`` does not crash anymore when ``__class__`` is assigned alongside another variable. - Closes #7467 (`#7467 <https://github.com/PyCQA/pylint/issues/7467>`_) + Closes #7467 (`#7467 <https://github.com/pylint-dev/pylint/issues/7467>`_) - ``--help-msg`` now accepts a comma-separated list of message IDs again. - Closes #7471 (`#7471 <https://github.com/PyCQA/pylint/issues/7471>`_) + Closes #7471 (`#7471 <https://github.com/pylint-dev/pylint/issues/7471>`_) - Allow specifying non-builtin exceptions in the ``overgeneral-exception`` option using an exception's qualified name. - Closes #7495 (`#7495 <https://github.com/PyCQA/pylint/issues/7495>`_) + Closes #7495 (`#7495 <https://github.com/pylint-dev/pylint/issues/7495>`_) - Report ``no-self-argument`` rather than ``no-method-argument`` for methods with variadic arguments. - Closes #7507 (`#7507 <https://github.com/PyCQA/pylint/issues/7507>`_) + Closes #7507 (`#7507 <https://github.com/pylint-dev/pylint/issues/7507>`_) - Fixed an issue where ``syntax-error`` couldn't be raised on files with invalid encodings. - Closes #7522 (`#7522 <https://github.com/PyCQA/pylint/issues/7522>`_) + Closes #7522 (`#7522 <https://github.com/pylint-dev/pylint/issues/7522>`_) - Fix false positive for ``redefined-outer-name`` when aliasing ``typing`` e.g. as ``t`` and guarding imports under ``t.TYPE_CHECKING``. - Closes #7524 (`#7524 <https://github.com/PyCQA/pylint/issues/7524>`_) + Closes #7524 (`#7524 <https://github.com/pylint-dev/pylint/issues/7524>`_) - Fixed a crash of the ``modified_iterating`` checker when iterating on a set defined as a class attribute. - Closes #7528 (`#7528 <https://github.com/PyCQA/pylint/issues/7528>`_) + Closes #7528 (`#7528 <https://github.com/pylint-dev/pylint/issues/7528>`_) - Use ``py-version`` to determine if a message should be emitted for messages defined with ``max-version`` or ``min-version``. - Closes #7569 (`#7569 <https://github.com/PyCQA/pylint/issues/7569>`_) + Closes #7569 (`#7569 <https://github.com/pylint-dev/pylint/issues/7569>`_) - Improve ``bad-thread-instantiation`` check to warn if ``target`` is not passed in as a keyword argument or as a second argument. - Closes #7570 (`#7570 <https://github.com/PyCQA/pylint/issues/7570>`_) + Closes #7570 (`#7570 <https://github.com/pylint-dev/pylint/issues/7570>`_) - Fixes edge case of custom method named ``next`` raised an astroid error. - Closes #7610 (`#7610 <https://github.com/PyCQA/pylint/issues/7610>`_) + Closes #7610 (`#7610 <https://github.com/pylint-dev/pylint/issues/7610>`_) - Fixed a multi-processing crash that prevents using any more than 1 thread on MacOS. @@ -717,56 +717,56 @@ Other Bug Fixes when attempting to serialise the linter object for multi-processing use. - Closes #7635. (`#7635 <https://github.com/PyCQA/pylint/issues/7635>`_) + Closes #7635. (`#7635 <https://github.com/pylint-dev/pylint/issues/7635>`_) - Fix crash that happened when parsing files with unexpected encoding starting with 'utf' like ``utf13``. - Closes #7661 (`#7661 <https://github.com/PyCQA/pylint/issues/7661>`_) + Closes #7661 (`#7661 <https://github.com/pylint-dev/pylint/issues/7661>`_) - Fix a crash when a child class with an ``__init__`` method inherits from a parent class with an ``__init__`` class attribute. - Closes #7742 (`#7742 <https://github.com/PyCQA/pylint/issues/7742>`_) + Closes #7742 (`#7742 <https://github.com/pylint-dev/pylint/issues/7742>`_) - Fix ``valid-metaclass-classmethod-first-arg`` default config value from "cls" to "mcs" which would cause both a false-positive and false-negative. - Closes #7782 (`#7782 <https://github.com/PyCQA/pylint/issues/7782>`_) + Closes #7782 (`#7782 <https://github.com/pylint-dev/pylint/issues/7782>`_) - Fixes a crash in the ``unnecessary_list_index_lookup`` check when using ``enumerate`` with ``start`` and a class attribute. - Closes #7821 (`#7821 <https://github.com/PyCQA/pylint/issues/7821>`_) + Closes #7821 (`#7821 <https://github.com/pylint-dev/pylint/issues/7821>`_) - Fixes a crash in ``stop-iteration-return`` when the ``next`` builtin is called without arguments. - Closes #7828 (`#7828 <https://github.com/PyCQA/pylint/issues/7828>`_) + Closes #7828 (`#7828 <https://github.com/pylint-dev/pylint/issues/7828>`_) - When pylint exit due to bad arguments being provided the exit code will now be the expected ``32``. - Refs #7931 (`#7931 <https://github.com/PyCQA/pylint/issues/7931>`_) + Refs #7931 (`#7931 <https://github.com/pylint-dev/pylint/issues/7931>`_) - Fixes a ``ModuleNotFound`` exception when running pylint on a Django project with the ``pylint_django`` plugin enabled. - Closes #7938 (`#7938 <https://github.com/PyCQA/pylint/issues/7938>`_) + Closes #7938 (`#7938 <https://github.com/pylint-dev/pylint/issues/7938>`_) - Fixed a crash when inferring a value and using its qname on a slice that was being incorrectly called. - Closes #8067 (`#8067 <https://github.com/PyCQA/pylint/issues/8067>`_) + Closes #8067 (`#8067 <https://github.com/pylint-dev/pylint/issues/8067>`_) - Use better regex to check for private attributes. - Refs #8081 (`#8081 <https://github.com/PyCQA/pylint/issues/8081>`_) + Refs #8081 (`#8081 <https://github.com/pylint-dev/pylint/issues/8081>`_) - Fix issue with new typing Union syntax in runtime context for Python 3.10+. - Closes #8119 (`#8119 <https://github.com/PyCQA/pylint/issues/8119>`_) + Closes #8119 (`#8119 <https://github.com/pylint-dev/pylint/issues/8119>`_) @@ -775,55 +775,55 @@ Other Changes - Pylint now provides basic support for Python 3.11. - Closes #5920 (`#5920 <https://github.com/PyCQA/pylint/issues/5920>`_) + Closes #5920 (`#5920 <https://github.com/pylint-dev/pylint/issues/5920>`_) - Update message for ``abstract-method`` to include child class name. - Closes #7124 (`#7124 <https://github.com/PyCQA/pylint/issues/7124>`_) + Closes #7124 (`#7124 <https://github.com/pylint-dev/pylint/issues/7124>`_) - Update Pyreverse's dot and plantuml printers to detect when class methods are abstract and show them with italic font. For the dot printer update the label to use html-like syntax. - Closes #7346 (`#7346 <https://github.com/PyCQA/pylint/issues/7346>`_) + Closes #7346 (`#7346 <https://github.com/pylint-dev/pylint/issues/7346>`_) - The ``docparams`` extension now considers typing in Numpy style docstrings as "documentation" for the ``missing-param-doc`` message. - Refs #7398 (`#7398 <https://github.com/PyCQA/pylint/issues/7398>`_) + Refs #7398 (`#7398 <https://github.com/pylint-dev/pylint/issues/7398>`_) - Relevant ``DeprecationWarnings`` are now raised with ``stacklevel=2``, so they have the callsite attached in the message. - Closes #7463 (`#7463 <https://github.com/PyCQA/pylint/issues/7463>`_) + Closes #7463 (`#7463 <https://github.com/pylint-dev/pylint/issues/7463>`_) - Add a ``minimal`` option to ``pylint-config`` and its toml generator. - Closes #7485 (`#7485 <https://github.com/PyCQA/pylint/issues/7485>`_) + Closes #7485 (`#7485 <https://github.com/pylint-dev/pylint/issues/7485>`_) - Add method name to the error messages of ``no-method-argument`` and ``no-self-argument``. - Closes #7507 (`#7507 <https://github.com/PyCQA/pylint/issues/7507>`_) + Closes #7507 (`#7507 <https://github.com/pylint-dev/pylint/issues/7507>`_) - Prevent leaving the pip install cache in the Docker image. - Refs #7544 (`#7544 <https://github.com/PyCQA/pylint/issues/7544>`_) + Refs #7544 (`#7544 <https://github.com/pylint-dev/pylint/issues/7544>`_) - Add a keyword-only ``compare_constants`` argument to ``safe_infer``. - Refs #7626 (`#7626 <https://github.com/PyCQA/pylint/issues/7626>`_) + Refs #7626 (`#7626 <https://github.com/pylint-dev/pylint/issues/7626>`_) - Add ``default_enabled`` option to optional message dict. Provides an option to disable a checker message by default. To use a disabled message, the user must enable it explicitly by adding the message to the ``enable`` option. - Refs #7629 (`#7629 <https://github.com/PyCQA/pylint/issues/7629>`_) + Refs #7629 (`#7629 <https://github.com/pylint-dev/pylint/issues/7629>`_) - Sort ``--generated-rcfile`` output. - Refs #7655 (`#7655 <https://github.com/PyCQA/pylint/issues/7655>`_) + Refs #7655 (`#7655 <https://github.com/pylint-dev/pylint/issues/7655>`_) - epylint is now deprecated and will be removed in pylint 3.0.0. All emacs and flymake related @@ -831,11 +831,11 @@ Other Changes repository : https://github.com/emacsorphanage/pylint. - Closes #7737 (`#7737 <https://github.com/PyCQA/pylint/issues/7737>`_) + Closes #7737 (`#7737 <https://github.com/pylint-dev/pylint/issues/7737>`_) - Adds test for existing preferred-modules configuration functionality. - Refs #7957 (`#7957 <https://github.com/PyCQA/pylint/issues/7957>`_) + Refs #7957 (`#7957 <https://github.com/pylint-dev/pylint/issues/7957>`_) @@ -850,4 +850,4 @@ Internal Changes the path in this way, this is now the last bit of work needed to close Github issue #7264. - Closes #7264 (`#7264 <https://github.com/PyCQA/pylint/issues/7264>`_) + Closes #7264 (`#7264 <https://github.com/pylint-dev/pylint/issues/7264>`_) diff --git a/doc/whatsnew/2/2.17/index.rst b/doc/whatsnew/2/2.17/index.rst index cd14488b7..9c5323b18 100644 --- a/doc/whatsnew/2/2.17/index.rst +++ b/doc/whatsnew/2/2.17/index.rst @@ -166,7 +166,7 @@ False Positives Fixed ``attribute-defined-outside-init`` warning when using ``unittest.IsolatedAsyncioTestCase``. - Refs #8403 (`#8403 <https://github.com/PyCQA/pylint/issues/8403>`_) + Refs #8403 (`#8403 <https://github.com/pylint-dev/pylint/issues/8403>`_) @@ -176,16 +176,16 @@ Other Bug Fixes - ``--clear-cache-post-run`` now also clears LRU caches for pylint utilities holding references to AST nodes. - Closes #8361 (`#8361 <https://github.com/PyCQA/pylint/issues/8361>`_) + Closes #8361 (`#8361 <https://github.com/pylint-dev/pylint/issues/8361>`_) - Fix a crash when ``TYPE_CHECKING`` is used without importing it. - Closes #8434 (`#8434 <https://github.com/PyCQA/pylint/issues/8434>`_) + Closes #8434 (`#8434 <https://github.com/pylint-dev/pylint/issues/8434>`_) - Fix a regression of ``preferred-modules`` where a partial match was used instead of the required full match. - Closes #8453 (`#8453 <https://github.com/PyCQA/pylint/issues/8453>`_) + Closes #8453 (`#8453 <https://github.com/pylint-dev/pylint/issues/8453>`_) @@ -203,7 +203,7 @@ Internal Changes ``is_sys_guard`` is still available, which was part of ``is_node_in_guarded_import_block``. - Refs #8433 (`#8433 <https://github.com/PyCQA/pylint/issues/8433>`_) + Refs #8433 (`#8433 <https://github.com/pylint-dev/pylint/issues/8433>`_) What's new in Pylint 2.17.0? @@ -217,42 +217,42 @@ New Features - `pyreverse` now supports custom color palettes with the `--color-palette` option. - Closes #6738 (`#6738 <https://github.com/PyCQA/pylint/issues/6738>`_) + Closes #6738 (`#6738 <https://github.com/pylint-dev/pylint/issues/6738>`_) - Add ``invalid-name`` check for ``TypeAlias`` names. - Closes #7081. (`#7081 <https://github.com/PyCQA/pylint/issues/7081>`_) + Closes #7081. (`#7081 <https://github.com/pylint-dev/pylint/issues/7081>`_) - Accept values of the form ``<class name>.<attribute name>`` for the ``exclude-protected`` list. - Closes #7343 (`#7343 <https://github.com/PyCQA/pylint/issues/7343>`_) + Closes #7343 (`#7343 <https://github.com/pylint-dev/pylint/issues/7343>`_) - Add `--version` option to `pyreverse`. - Refs #7851 (`#7851 <https://github.com/PyCQA/pylint/issues/7851>`_) + Refs #7851 (`#7851 <https://github.com/pylint-dev/pylint/issues/7851>`_) - Adds new functionality with preferred-modules configuration to detect submodules. - Refs #7957 (`#7957 <https://github.com/PyCQA/pylint/issues/7957>`_) + Refs #7957 (`#7957 <https://github.com/pylint-dev/pylint/issues/7957>`_) - Support implicit namespace packages (PEP 420). - Closes #8154 (`#8154 <https://github.com/PyCQA/pylint/issues/8154>`_) + Closes #8154 (`#8154 <https://github.com/pylint-dev/pylint/issues/8154>`_) - Add globbing pattern support for ``--source-roots``. - Closes #8290 (`#8290 <https://github.com/PyCQA/pylint/issues/8290>`_) + Closes #8290 (`#8290 <https://github.com/pylint-dev/pylint/issues/8290>`_) - Support globbing pattern when defining which file/directory/module to lint. - Closes #8310 (`#8310 <https://github.com/PyCQA/pylint/issues/8310>`_) + Closes #8310 (`#8310 <https://github.com/pylint-dev/pylint/issues/8310>`_) - pylint now supports ``TryStar`` nodes from Python 3.11 and should be fully compatible with Python 3.11. - Closes #8387 (`#8387 <https://github.com/PyCQA/pylint/issues/8387>`_) + Closes #8387 (`#8387 <https://github.com/pylint-dev/pylint/issues/8387>`_) @@ -263,13 +263,13 @@ New Checks there is a chained comparison where one expression is semantically incompatible with the other. - Closes #6559 (`#6559 <https://github.com/PyCQA/pylint/issues/6559>`_) + Closes #6559 (`#6559 <https://github.com/pylint-dev/pylint/issues/6559>`_) - Adds an ``implicit-flag-alias`` check that emits a warning when a class derived from ``enum.IntFlag`` assigns distinct integer values that share common bit positions. - Refs #8102 (`#8102 <https://github.com/PyCQA/pylint/issues/8102>`_) + Refs #8102 (`#8102 <https://github.com/pylint-dev/pylint/issues/8102>`_) @@ -279,27 +279,27 @@ False Positives Fixed - Fix various false positives for functions that return directly from structural pattern matching cases. - Closes #5288 (`#5288 <https://github.com/PyCQA/pylint/issues/5288>`_) + Closes #5288 (`#5288 <https://github.com/pylint-dev/pylint/issues/5288>`_) - Fix false positive for ``used-before-assignment`` when ``typing.TYPE_CHECKING`` is used with if/elif/else blocks. - Closes #7574 (`#7574 <https://github.com/PyCQA/pylint/issues/7574>`_) + Closes #7574 (`#7574 <https://github.com/pylint-dev/pylint/issues/7574>`_) - Fix false positive for isinstance-second-argument-not-valid-type with union types. - Closes #8205 (`#8205 <https://github.com/PyCQA/pylint/issues/8205>`_) + Closes #8205 (`#8205 <https://github.com/pylint-dev/pylint/issues/8205>`_) - Fix false positive for ``used-before-assignment`` for named expressions appearing after the first element in a list, tuple, or set. - Closes #8252 (`#8252 <https://github.com/PyCQA/pylint/issues/8252>`_) + Closes #8252 (`#8252 <https://github.com/pylint-dev/pylint/issues/8252>`_) - Fix false positive for ``wrong-spelling-in-comment`` with class names in a python 2 type comment. - Closes #8370 (`#8370 <https://github.com/PyCQA/pylint/issues/8370>`_) + Closes #8370 (`#8370 <https://github.com/pylint-dev/pylint/issues/8370>`_) @@ -312,11 +312,11 @@ False Negatives Fixed raise correctly. - Refs #8185 (`#8185 <https://github.com/PyCQA/pylint/issues/8185>`_) + Refs #8185 (`#8185 <https://github.com/pylint-dev/pylint/issues/8185>`_) - Fix false negative for inconsistent-returns with while-loops. - Closes #8280 (`#8280 <https://github.com/PyCQA/pylint/issues/8280>`_) + Closes #8280 (`#8280 <https://github.com/pylint-dev/pylint/issues/8280>`_) @@ -326,33 +326,33 @@ Other Bug Fixes - Fix ``used-before-assignment`` false positive when the walrus operator is used with a ternary operator in dictionary key/value initialization. - Closes #8125 (`#8125 <https://github.com/PyCQA/pylint/issues/8125>`_) + Closes #8125 (`#8125 <https://github.com/pylint-dev/pylint/issues/8125>`_) - Fix ``no-name-in-module`` false positive raised when a package defines a variable with the same name as one of its submodules. - Closes #8148 (`#8148 <https://github.com/PyCQA/pylint/issues/8148>`_) + Closes #8148 (`#8148 <https://github.com/pylint-dev/pylint/issues/8148>`_) - Fix a crash happening for python interpreter < 3.9 following a failed typing update. - Closes #8161 (`#8161 <https://github.com/PyCQA/pylint/issues/8161>`_) + Closes #8161 (`#8161 <https://github.com/pylint-dev/pylint/issues/8161>`_) - Fix ``nested-min-max`` suggestion message to indicate it's possible to splat iterable objects. - Closes #8168 (`#8168 <https://github.com/PyCQA/pylint/issues/8168>`_) + Closes #8168 (`#8168 <https://github.com/pylint-dev/pylint/issues/8168>`_) - Fix a crash happening when a class attribute was negated in the start argument of an enumerate. - Closes #8207 (`#8207 <https://github.com/PyCQA/pylint/issues/8207>`_) + Closes #8207 (`#8207 <https://github.com/pylint-dev/pylint/issues/8207>`_) - Prevent emitting ``invalid-name`` for the line on which a ``global`` statement is declared. - Closes #8307 (`#8307 <https://github.com/PyCQA/pylint/issues/8307>`_) + Closes #8307 (`#8307 <https://github.com/pylint-dev/pylint/issues/8307>`_) @@ -361,7 +361,7 @@ Other Changes - Update explanation for ``global-variable-not-assigned`` and add confidence. - Closes #5073 (`#5073 <https://github.com/PyCQA/pylint/issues/5073>`_) + Closes #5073 (`#5073 <https://github.com/pylint-dev/pylint/issues/5073>`_) - The governance model and the path to become a maintainer have been documented as @@ -369,4 +369,4 @@ Other Changes pylint is included is secure. - Refs #8329 (`#8329 <https://github.com/PyCQA/pylint/issues/8329>`_) + Refs #8329 (`#8329 <https://github.com/pylint-dev/pylint/issues/8329>`_) diff --git a/doc/whatsnew/2/2.3/full.rst b/doc/whatsnew/2/2.3/full.rst index d55021275..947eedbac 100644 --- a/doc/whatsnew/2/2.3/full.rst +++ b/doc/whatsnew/2/2.3/full.rst @@ -13,7 +13,7 @@ Release date: 2019-02-27 Doesn't make that much sense for ``pylint`` itself, which is why we're handling the exception here, rather than in ``astroid`` - Closes PyCQA/astroid#644 + Closes pylint-dev/astroid#644 * Added a new command line option ``list-groups`` for listing all the check groups ``pylint`` knows about. diff --git a/doc/whatsnew/2/2.9/full.rst b/doc/whatsnew/2/2.9/full.rst index 5518f5464..417943e93 100644 --- a/doc/whatsnew/2/2.9/full.rst +++ b/doc/whatsnew/2/2.9/full.rst @@ -304,12 +304,12 @@ Release date: 2021-06-29 * Fix false-positive ``no-member`` with generic base class - Closes PyCQA/astroid#942 + Closes pylint-dev/astroid#942 * Fix ``assigning-non-slot`` false-positive with base that inherits from ``typing.Generic`` Closes #4509 - Closes PyCQA/astroid#999 + Closes pylint-dev/astroid#999 * New checker ``invalid-all-format``. Emitted when ``__all__`` has an invalid format, i.e. isn't a ``tuple`` or ``list``. diff --git a/doc/whatsnew/3/3.0/index.rst b/doc/whatsnew/3/3.0/index.rst new file mode 100644 index 000000000..d58fa3f1a --- /dev/null +++ b/doc/whatsnew/3/3.0/index.rst @@ -0,0 +1,23 @@ +************************* + What's New in Pylint 3.0 +************************* + +.. toctree:: + :maxdepth: 2 + +:Release: 3.0.0 +:Date: TBA + + +Summary -- Release highlights +============================= + +In ``3.0.0``, we're enacting necessary breaking changes and long +announced deprecations. + +There's going to be frequent beta releases, +before the official releases, everyone is welcome to try the betas +so we find problems before the actual release. + + +.. towncrier release notes start diff --git a/doc/whatsnew/3/index.rst b/doc/whatsnew/3/index.rst new file mode 100644 index 000000000..67e4fd06a --- /dev/null +++ b/doc/whatsnew/3/index.rst @@ -0,0 +1,9 @@ +3.x +=== + +This is the full list of change in pylint 3.x minors, by categories. + +.. toctree:: + :maxdepth: 2 + + 3.0/index diff --git a/doc/whatsnew/fragments/1144.false_negative b/doc/whatsnew/fragments/1144.false_negative new file mode 100644 index 000000000..9b30c197b --- /dev/null +++ b/doc/whatsnew/fragments/1144.false_negative @@ -0,0 +1,3 @@ +Emit ``used-before-assignment`` when calling module-level functions before definition. + +Closes #1144 diff --git a/doc/whatsnew/fragments/1954.performance b/doc/whatsnew/fragments/1954.performance new file mode 100644 index 000000000..aa065f0d1 --- /dev/null +++ b/doc/whatsnew/fragments/1954.performance @@ -0,0 +1,4 @@ +- Optimize `is_trailing_comma()`. +- Cache `class_is_abstract()`. + +Refs #1954 diff --git a/doc/whatsnew/fragments/3670.false_positive b/doc/whatsnew/fragments/3670.false_positive new file mode 100644 index 000000000..562a41de2 --- /dev/null +++ b/doc/whatsnew/fragments/3670.false_positive @@ -0,0 +1,3 @@ +Fix `unused-argument` false positive when `__new__` does not use all the arguments of `__init__`. + +Closes #3670 diff --git a/doc/whatsnew/fragments/5488.other b/doc/whatsnew/fragments/5488.other new file mode 100644 index 000000000..0f6ac5b85 --- /dev/null +++ b/doc/whatsnew/fragments/5488.other @@ -0,0 +1,3 @@ +Pylint now exposes its type annotations. + +Closes #5488 and #2079 diff --git a/doc/whatsnew/fragments/6306.breaking b/doc/whatsnew/fragments/6306.breaking new file mode 100644 index 000000000..8338251b6 --- /dev/null +++ b/doc/whatsnew/fragments/6306.breaking @@ -0,0 +1,3 @@ +Remove support for Python 3.7. + +Refs #6306 diff --git a/doc/whatsnew/fragments/6871.user_action b/doc/whatsnew/fragments/6871.user_action new file mode 100644 index 000000000..7cabc1ca1 --- /dev/null +++ b/doc/whatsnew/fragments/6871.user_action @@ -0,0 +1,17 @@ +The compare to empty string checker (``pylint.extensions.emptystring``) and the compare to +zero checker (``pylint.extensions.compare-to-zero``) have been removed and their checks are +now part of the implicit booleaness checker: + +``compare-to-zero`` was renamed ``use-implicit-booleaness-not-comparison-to-zero`` and +``compare-to-empty-string`` was renamed ``use-implicit-booleaness-not-comparison-to-string`` +and they now need to be enabled explicitly. + +The `pylint.extensions.emptystring`` and ``pylint.extensions.compare-to-zero`` extensions +no longer exists and needs to be removed from the ``load-plugins`` option. + +Messages related to implicit booleaness were made more explicit and actionable. + +This permits to make their likeness explicit and will provide better performance as they share most of their +conditions to be raised. + +Closes #6871 diff --git a/doc/whatsnew/fragments/7163.other b/doc/whatsnew/fragments/7163.other new file mode 100644 index 000000000..93f731aae --- /dev/null +++ b/doc/whatsnew/fragments/7163.other @@ -0,0 +1,3 @@ +Search for ``pyproject.toml`` recursively in parent directories up to a project or file system root. + +Refs #7163, Closes #3289 diff --git a/doc/whatsnew/fragments/7506.false_positive b/doc/whatsnew/fragments/7506.false_positive new file mode 100644 index 000000000..c6424e1f2 --- /dev/null +++ b/doc/whatsnew/fragments/7506.false_positive @@ -0,0 +1,3 @@ +Fix ``unused-import`` false positive for usage of ``six.with_metaclass``. + +Closes #7506 diff --git a/doc/whatsnew/fragments/7578.bugfix b/doc/whatsnew/fragments/7578.bugfix new file mode 100644 index 000000000..2b01149ca --- /dev/null +++ b/doc/whatsnew/fragments/7578.bugfix @@ -0,0 +1,3 @@ +The ``ignored-modules`` option will now be correctly taken into account for ``no-name-in-module``. + +Closes #7578 diff --git a/doc/whatsnew/fragments/7737.user_action b/doc/whatsnew/fragments/7737.user_action new file mode 100644 index 000000000..1a992f563 --- /dev/null +++ b/doc/whatsnew/fragments/7737.user_action @@ -0,0 +1,3 @@ +epylint was removed. It now lives at: https://github.com/emacsorphanage/pylint. + +Refs #7737 diff --git a/doc/whatsnew/fragments/8167.false_positive b/doc/whatsnew/fragments/8167.false_positive new file mode 100644 index 000000000..e0c341f65 --- /dev/null +++ b/doc/whatsnew/fragments/8167.false_positive @@ -0,0 +1,4 @@ +Fix false positive for ``used-before-assignment`` when usage and assignment +are guarded by the same test in different statements. + +Closes #8167 diff --git a/doc/whatsnew/fragments/8181.feature b/doc/whatsnew/fragments/8181.feature new file mode 100644 index 000000000..cd5b361d1 --- /dev/null +++ b/doc/whatsnew/fragments/8181.feature @@ -0,0 +1,5 @@ +Add new option (``--show-stdlib``, ``-L``) to ``pyreverse``. +This is similar to the behavior of ``--show-builtin`` in that standard library +modules are now not included by default, and this option will include them. + +Closes #8181 diff --git a/doc/whatsnew/fragments/8198.bugfix b/doc/whatsnew/fragments/8198.bugfix new file mode 100644 index 000000000..61b4028ce --- /dev/null +++ b/doc/whatsnew/fragments/8198.bugfix @@ -0,0 +1,4 @@ +Fix ``used-before-assignment`` false negative when TYPE_CHECKING imports +are used in multiple scopes. + +Closes #8198 diff --git a/doc/whatsnew/fragments/8251.breaking b/doc/whatsnew/fragments/8251.breaking new file mode 100644 index 000000000..5410c9a98 --- /dev/null +++ b/doc/whatsnew/fragments/8251.breaking @@ -0,0 +1,5 @@ +`pyreverse` now uses a new default color palette that is more colorblind friendly. +The color scheme is taken from `Paul Tol's Notes <https://personal.sron.nl/~pault/>`_. +If you prefer other colors, you can use the `--color-palette` option to specify custom colors. + +Closes #8251 diff --git a/doc/whatsnew/fragments/8361.bugfix b/doc/whatsnew/fragments/8361.bugfix new file mode 100644 index 000000000..0f2b56707 --- /dev/null +++ b/doc/whatsnew/fragments/8361.bugfix @@ -0,0 +1,4 @@ +``--clear-cache-post-run`` now also clears LRU caches for pylint utilities +holding references to AST nodes. + +Closes #8361 diff --git a/doc/whatsnew/fragments/8401.internal b/doc/whatsnew/fragments/8401.internal new file mode 100644 index 000000000..9f4f92740 --- /dev/null +++ b/doc/whatsnew/fragments/8401.internal @@ -0,0 +1,4 @@ +``get_message_definition`` was removed from the base checker API. You can access +message definitions through the ``MessageStore``. + +Refs #8401 diff --git a/doc/whatsnew/fragments/8403.false_positive b/doc/whatsnew/fragments/8403.false_positive new file mode 100644 index 000000000..bfa34d17d --- /dev/null +++ b/doc/whatsnew/fragments/8403.false_positive @@ -0,0 +1,5 @@ +Adds ``asyncSetUp`` to the default ``defining-attr-methods`` list to silence +``attribute-defined-outside-init`` warning when using +``unittest.IsolatedAsyncioTestCase``. + +Refs #8403 diff --git a/doc/whatsnew/fragments/8404.breaking b/doc/whatsnew/fragments/8404.breaking new file mode 100644 index 000000000..eb99510eb --- /dev/null +++ b/doc/whatsnew/fragments/8404.breaking @@ -0,0 +1,7 @@ +Everything related to the ``__implements__`` construct was removed. It was based on PEP245 +that was proposed in 2001 and rejected in 2006. + +The capability from pyreverse to take ``__implements__`` into account when generating diagrams +was also removed. + +Refs #8404 diff --git a/doc/whatsnew/fragments/8404.internal b/doc/whatsnew/fragments/8404.internal new file mode 100644 index 000000000..1a6da408a --- /dev/null +++ b/doc/whatsnew/fragments/8404.internal @@ -0,0 +1,8 @@ +Everything related to the ``__implements__`` construct was removed. It was based on PEP245 +that was proposed in 2001 and rejected in 2006. + +All the classes inheriting ``Interface`` in ``pylint.interfaces`` were removed. +``Checker`` should only inherit ``BaseChecker`` or any of the other checker types +from ``pylint.checkers``. ``Reporter`` should only inherit ``BaseReporter``. + +Refs #8404 diff --git a/doc/whatsnew/fragments/8405.other b/doc/whatsnew/fragments/8405.other new file mode 100644 index 000000000..423e50611 --- /dev/null +++ b/doc/whatsnew/fragments/8405.other @@ -0,0 +1,3 @@ +All code related to the optparse config parsing has been removed. + +Refs #8405 diff --git a/doc/whatsnew/fragments/8407.internal b/doc/whatsnew/fragments/8407.internal new file mode 100644 index 000000000..bb96c2f5d --- /dev/null +++ b/doc/whatsnew/fragments/8407.internal @@ -0,0 +1,5 @@ +``modname`` and ``msg_store`` are now required to be given in ``FileState``. +``collect_block_lines`` has also been removed. ``Pylinter.current_name`` +cannot be null anymore. + +Refs #8407 diff --git a/doc/whatsnew/fragments/8408.internal b/doc/whatsnew/fragments/8408.internal new file mode 100644 index 000000000..697a7ee50 --- /dev/null +++ b/doc/whatsnew/fragments/8408.internal @@ -0,0 +1,3 @@ +'Reporter.set_output' was removed in favor of 'reporter.out = stream'. + +Refs #8408 diff --git a/doc/whatsnew/fragments/8409.internal b/doc/whatsnew/fragments/8409.internal new file mode 100644 index 000000000..415dec9cf --- /dev/null +++ b/doc/whatsnew/fragments/8409.internal @@ -0,0 +1,24 @@ +A number of old utility functions and classes have been removed: + +``MapReduceMixin``: To make a checker reduce map data simply implement +``get_map_data`` and ``reduce_map_data``. + +``is_inside_lambda``: Use ``utils.get_node_first_ancestor_of_type(x, nodes.Lambda)`` + +``check_messages``: Use ``utils.only_required_for_messages`` + +``is_class_subscriptable_pep585_with_postponed_evaluation_enabled``: Use +``is_postponed_evaluation_enabled(node)`` and ``is_node_in_type_annotation_context(node)`` + +``get_python_path``: assumption that there's always an __init__.py is not true since +python 3.3 and is causing problems, particularly with PEP 420. Use ``discover_package_path`` +and pass source root(s). + +``fix_import_path``: Use ``augmented_sys_path`` and pass additional ``sys.path`` +entries as an argument obtained from ``discover_package_path``. + +``get_global_option``: Use ``checker.linter.config`` to get all global options. + +Related private objects have been removed as well. + +Refs #8409 diff --git a/doc/whatsnew/fragments/8410.false_positive b/doc/whatsnew/fragments/8410.false_positive new file mode 100644 index 000000000..264542a7d --- /dev/null +++ b/doc/whatsnew/fragments/8410.false_positive @@ -0,0 +1,3 @@ +`logging-not-lazy` is not longer emitted for explicitly concatenated string arguments. + +Closes #8410 diff --git a/doc/whatsnew/fragments/8411.user_action b/doc/whatsnew/fragments/8411.user_action new file mode 100644 index 000000000..42f9c502a --- /dev/null +++ b/doc/whatsnew/fragments/8411.user_action @@ -0,0 +1,7 @@ +The 'overgeneral-exceptions' option now only takes fully qualified name +into account (``builtins.Exception`` not ``Exception``). If you overrode +this option, you need to use the fully qualified name now. + +There's still a warning, but it will be removed in 3.1.0. + +Refs #8411 diff --git a/doc/whatsnew/fragments/8412.internal b/doc/whatsnew/fragments/8412.internal new file mode 100644 index 000000000..ef12ebd18 --- /dev/null +++ b/doc/whatsnew/fragments/8412.internal @@ -0,0 +1,3 @@ +``colorize_ansi`` now only accept a ``MessageStyle`` object. + +Refs #8412 diff --git a/doc/whatsnew/fragments/8416.breaking b/doc/whatsnew/fragments/8416.breaking new file mode 100644 index 000000000..7984da1b1 --- /dev/null +++ b/doc/whatsnew/fragments/8416.breaking @@ -0,0 +1,3 @@ +``pyreverse``: Support for the ``.vcg`` output format (Visualaization of Compiler Graphs) has been dropped. + +Closes #8416 diff --git a/doc/whatsnew/fragments/8424.false_positive b/doc/whatsnew/fragments/8424.false_positive new file mode 100644 index 000000000..22dc8b844 --- /dev/null +++ b/doc/whatsnew/fragments/8424.false_positive @@ -0,0 +1,3 @@ +Fix false positive for isinstance-second-argument-not-valid-type when union types contains None. + +Closes #8424 diff --git a/doc/whatsnew/fragments/8433.internal b/doc/whatsnew/fragments/8433.internal new file mode 100644 index 000000000..4bc20c493 --- /dev/null +++ b/doc/whatsnew/fragments/8433.internal @@ -0,0 +1,10 @@ +The following utilities are deprecated in favor of the more robust ``in_type_checking_block`` +and will be removed in pylint 3.0: + + - ``is_node_in_guarded_import_block`` + - ``is_node_in_typing_guarded_import_block`` + - ``is_typing_guard`` + +``is_sys_guard`` is still available, which was part of ``is_node_in_guarded_import_block``. + +Refs #8433 diff --git a/doc/whatsnew/fragments/8434.bugfix b/doc/whatsnew/fragments/8434.bugfix new file mode 100644 index 000000000..b5a8bddcb --- /dev/null +++ b/doc/whatsnew/fragments/8434.bugfix @@ -0,0 +1,3 @@ +Fix a crash when ``TYPE_CHECKING`` is used without importing it. + +Closes #8434 diff --git a/doc/whatsnew/fragments/8437.bugfix b/doc/whatsnew/fragments/8437.bugfix new file mode 100644 index 000000000..c1727f950 --- /dev/null +++ b/doc/whatsnew/fragments/8437.bugfix @@ -0,0 +1,4 @@ +Fix a ``used-before-assignment`` false positive when imports +are made under the ``TYPE_CHECKING`` else if branch. + +Closes #8437 diff --git a/doc/whatsnew/fragments/8453.bugfix b/doc/whatsnew/fragments/8453.bugfix new file mode 100644 index 000000000..6bec2b0b9 --- /dev/null +++ b/doc/whatsnew/fragments/8453.bugfix @@ -0,0 +1,3 @@ +Fix a regression of ``preferred-modules`` where a partial match was used instead of the required full match. + +Closes #8453 diff --git a/doc/whatsnew/fragments/8462.breaking b/doc/whatsnew/fragments/8462.breaking new file mode 100644 index 000000000..c794235c0 --- /dev/null +++ b/doc/whatsnew/fragments/8462.breaking @@ -0,0 +1,5 @@ +The warning when the now useless old pylint cache directory (pylint.d) was +found was removed. The cache dir is documented in +[the FAQ](https://pylint.readthedocs.io/en/latest/faq.html#where-is-the-persistent-data-stored-to-compare-between-successive-runs). + +Refs #8462 diff --git a/doc/whatsnew/fragments/8463.internal b/doc/whatsnew/fragments/8463.internal new file mode 100644 index 000000000..de5df2520 --- /dev/null +++ b/doc/whatsnew/fragments/8463.internal @@ -0,0 +1,3 @@ +Following a deprecation period, ``Pylinter.check`` now only work with sequences of strings, not strings. + +Refs #8463 diff --git a/doc/whatsnew/fragments/8464.internal b/doc/whatsnew/fragments/8464.internal new file mode 100644 index 000000000..4b4109c7b --- /dev/null +++ b/doc/whatsnew/fragments/8464.internal @@ -0,0 +1,3 @@ +Following a deprecation period, ``ColorizedTextReporter`` only accepts ``ColorMappingDict``. + +Refs #8464 diff --git a/doc/whatsnew/fragments/8465.user_action b/doc/whatsnew/fragments/8465.user_action new file mode 100644 index 000000000..b5d802a93 --- /dev/null +++ b/doc/whatsnew/fragments/8465.user_action @@ -0,0 +1,5 @@ +Following a deprecation period, it's no longer possible to use ``MASTER`` +or ``master`` as configuration section in ``setup.cfg`` or ``tox.ini``. It's bad practice +to not start sections titles with the tool name. Please use ``pylint.main`` instead. + +Refs #8465 diff --git a/doc/whatsnew/fragments/8466.internal b/doc/whatsnew/fragments/8466.internal new file mode 100644 index 000000000..101a8e4ba --- /dev/null +++ b/doc/whatsnew/fragments/8466.internal @@ -0,0 +1,5 @@ +Following a deprecation period, ``MessageTest``'s ``end_line`` and ``end_col_offset`` +must be accurate in functional tests (for python 3.8 or above on cpython, and for +python 3.9 or superior on pypy). + +Refs #8466 diff --git a/doc/whatsnew/fragments/8472.internal b/doc/whatsnew/fragments/8472.internal new file mode 100644 index 000000000..6e9c3956a --- /dev/null +++ b/doc/whatsnew/fragments/8472.internal @@ -0,0 +1,4 @@ +Following a deprecation period, the ``do_exit`` argument of the ``Run`` class (and of the ``_Run`` +class in testutils) were removed. + +Refs #8472 diff --git a/doc/whatsnew/fragments/8473.internal b/doc/whatsnew/fragments/8473.internal new file mode 100644 index 000000000..11491dd57 --- /dev/null +++ b/doc/whatsnew/fragments/8473.internal @@ -0,0 +1,6 @@ +Following a deprecation period, the ``py_version`` argument of the +``MessageDefinition.may_be_emitted`` function is now required. The most likely solution +is to use 'linter.config.py_version' if you need to keep using this +function, or to use 'MessageDefinition.is_message_enabled' instead. + +Refs #8473 diff --git a/doc/whatsnew/fragments/8474.internal b/doc/whatsnew/fragments/8474.internal new file mode 100644 index 000000000..07120ba34 --- /dev/null +++ b/doc/whatsnew/fragments/8474.internal @@ -0,0 +1,5 @@ +Following a deprecation period, the ``OutputLine`` class now requires +the right number of argument all the time. The functional output can be +regenerated automatically to achieve that easily. + +Refs #8474 diff --git a/doc/whatsnew/fragments/8475.internal b/doc/whatsnew/fragments/8475.internal new file mode 100644 index 000000000..0451554e9 --- /dev/null +++ b/doc/whatsnew/fragments/8475.internal @@ -0,0 +1,5 @@ +Following a deprecation period, ``is_typing_guard``, ``is_node_in_typing_guarded_import_block`` and +``is_node_in_guarded_import_block``: from ``pylint.utils`` were removed: use a combination of +``is_sys_guard`` and ``in_type_checking_block`` instead. + +Refs #8475 diff --git a/doc/whatsnew/fragments/8476.feature b/doc/whatsnew/fragments/8476.feature new file mode 100644 index 000000000..56c0be201 --- /dev/null +++ b/doc/whatsnew/fragments/8476.feature @@ -0,0 +1,3 @@ +Add Pyreverse option to exclude standalone nodes from diagrams with `--no-standalone`. + +Closes #8476 diff --git a/doc/whatsnew/fragments/8477.internal b/doc/whatsnew/fragments/8477.internal new file mode 100644 index 000000000..d7b043521 --- /dev/null +++ b/doc/whatsnew/fragments/8477.internal @@ -0,0 +1,4 @@ +Following a deprecation period, the ``location`` argument of the +``Message`` class must now be a ``MessageLocationTuple``. + +Refs #8477 diff --git a/doc/whatsnew/fragments/8478.internal b/doc/whatsnew/fragments/8478.internal new file mode 100644 index 000000000..b1b158508 --- /dev/null +++ b/doc/whatsnew/fragments/8478.internal @@ -0,0 +1,4 @@ +Following a deprecation period, the ``check_single_file`` function of the +``Pylinter`` is replaced by ``Pylinter.check_single_file_item``. + +Refs #8478 diff --git a/doc/whatsnew/fragments/8485.false_positive b/doc/whatsnew/fragments/8485.false_positive new file mode 100644 index 000000000..8eac08b95 --- /dev/null +++ b/doc/whatsnew/fragments/8485.false_positive @@ -0,0 +1,5 @@ +``invalid-name`` now allows for integers in ``typealias`` names: +- now valid: ``Good2Name``, ``GoodName2``. +- still invalid: ``_1BadName``. + +Closes #8485 diff --git a/doc/whatsnew/fragments/8487.false_positive b/doc/whatsnew/fragments/8487.false_positive new file mode 100644 index 000000000..9ff5e3482 --- /dev/null +++ b/doc/whatsnew/fragments/8487.false_positive @@ -0,0 +1,3 @@ +No longer consider ``Union`` as type annotation as type alias for naming checks. + +Closes #8487 diff --git a/doc/whatsnew/fragments/8496.false_positive b/doc/whatsnew/fragments/8496.false_positive new file mode 100644 index 000000000..3ea0fca6c --- /dev/null +++ b/doc/whatsnew/fragments/8496.false_positive @@ -0,0 +1,5 @@ +``unnecessary-lambda`` no longer warns on lambdas which use its parameters in +their body (other than the final arguments), e.g. +``lambda foo: (bar if foo else baz)(foo)``. + +Closes #8496 diff --git a/doc/whatsnew/fragments/8500.false_positive b/doc/whatsnew/fragments/8500.false_positive new file mode 100644 index 000000000..ced61766a --- /dev/null +++ b/doc/whatsnew/fragments/8500.false_positive @@ -0,0 +1,3 @@ +Fixed `unused-import` so that it observes the `dummy-variables-rgx` option. + +Closes #8500 diff --git a/doc/whatsnew/fragments/8504.bugfix b/doc/whatsnew/fragments/8504.bugfix new file mode 100644 index 000000000..2b54ac7b6 --- /dev/null +++ b/doc/whatsnew/fragments/8504.bugfix @@ -0,0 +1,3 @@ +Fix a crash in pyreverse when "/" characters are used in the output filename e.g pyreverse -o png -p name/ path/to/project. + +Closes #8504 diff --git a/doc/whatsnew/fragments/8536.false_negative b/doc/whatsnew/fragments/8536.false_negative new file mode 100644 index 000000000..8b24bc96f --- /dev/null +++ b/doc/whatsnew/fragments/8536.false_negative @@ -0,0 +1,3 @@ +`TypeAlias` variables defined in functions are now checked for `invalid-name` errors. + +Closes #8536 diff --git a/doc/whatsnew/fragments/8540.false_positive b/doc/whatsnew/fragments/8540.false_positive new file mode 100644 index 000000000..543913637 --- /dev/null +++ b/doc/whatsnew/fragments/8540.false_positive @@ -0,0 +1,4 @@ +`Union` typed variables without assignment are no longer treated as +`TypeAlias`. + +Closes #8540 diff --git a/doc/whatsnew/fragments/8555.false_positive b/doc/whatsnew/fragments/8555.false_positive new file mode 100644 index 000000000..157486b39 --- /dev/null +++ b/doc/whatsnew/fragments/8555.false_positive @@ -0,0 +1,3 @@ +Fix false positive for ``positional-only-arguments-expected`` when a function contains both a positional-only parameter that has a default value, and ``**kwargs``. + +Closes #8555 diff --git a/doc/whatsnew/fragments/8559.false_negative b/doc/whatsnew/fragments/8559.false_negative new file mode 100644 index 000000000..37c415138 --- /dev/null +++ b/doc/whatsnew/fragments/8559.false_negative @@ -0,0 +1,3 @@ +Fix false negative for ``no-value-for-parameter`` when a function, whose signature contains both a positional-only parameter ``name`` and also ``*kwargs``, is called with a keyword-argument for ``name``. + +Closes #8559 diff --git a/doc/whatsnew/fragments/8563.bugfix b/doc/whatsnew/fragments/8563.bugfix new file mode 100644 index 000000000..3c9d38b1c --- /dev/null +++ b/doc/whatsnew/fragments/8563.bugfix @@ -0,0 +1,3 @@ +Improve output of ``consider-using-generator`` message for ``min()` calls with ``default`` keyword. + +Closes #8563 diff --git a/doc/whatsnew/fragments/8570.false_positive b/doc/whatsnew/fragments/8570.false_positive new file mode 100644 index 000000000..fec3a855e --- /dev/null +++ b/doc/whatsnew/fragments/8570.false_positive @@ -0,0 +1,3 @@ +Fix false positive for ``keyword-arg-before-vararg`` when a positional-only parameter with a default value precedes ``*args``. + +Closes #8570 diff --git a/doc/whatsnew/fragments/8603.bugfix b/doc/whatsnew/fragments/8603.bugfix new file mode 100644 index 000000000..1a1025c4b --- /dev/null +++ b/doc/whatsnew/fragments/8603.bugfix @@ -0,0 +1,3 @@ +``pyreverse``: added escaping of vertical bar character in annotation labels produced by DOT printer to ensure it is not treated as field separator of record-based nodes. + +Closes #8603 diff --git a/doc/whatsnew/fragments/8613.false_positive b/doc/whatsnew/fragments/8613.false_positive new file mode 100644 index 000000000..80d28e9c2 --- /dev/null +++ b/doc/whatsnew/fragments/8613.false_positive @@ -0,0 +1,3 @@ +Fix a false positive for ``bad-dunder-name`` when there is a user-defined ``__index__`` method. + +Closes #8613 diff --git a/doc/whatsnew/fragments/8632.bugfix b/doc/whatsnew/fragments/8632.bugfix new file mode 100644 index 000000000..c6f9c01bf --- /dev/null +++ b/doc/whatsnew/fragments/8632.bugfix @@ -0,0 +1,4 @@ +Fixed a crash when generating a configuration file: ``tomlkit.exceptions.TOMLKitError: Can't add a table to a dotted key`` +caused by tomlkit ``v0.11.8``. + +Closes #8632 diff --git a/doc/whatsnew/index.rst b/doc/whatsnew/index.rst index 47aae955d..4e9c22fea 100644 --- a/doc/whatsnew/index.rst +++ b/doc/whatsnew/index.rst @@ -5,6 +5,7 @@ :titlesonly: :hidden: + 3/index 2/index 1/index 0/index |