From 13570287ae7b0fcc75805ff4ef64e0ac3f7271a2 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Sun, 1 Oct 2023 10:52:36 +0200 Subject: [PATCH] [doc] Upgrade doc following the full implementation of pyupgrade in ruff See https://github.com/astral-sh/ruff/issues/827 --- README.rst | 10 +++++----- .../c/consider-using-dict-comprehension/details.rst | 3 ++- .../c/consider-using-set-comprehension/details.rst | 3 ++- doc/whatsnew/2/2.11/summary.rst | 4 ++-- pylint/checkers/base_checker.py | 4 +--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.rst b/README.rst index bbb4c4f60e..2910eba680 100644 --- a/README.rst +++ b/README.rst @@ -129,11 +129,11 @@ Advised linters alongside pylint -------------------------------- Projects that you might want to use alongside pylint include ruff_ (**really** fast, -with builtin auto-fix and a growing number of checks taken from popular -linters but implemented in ``rust``) or flake8_ (faster and simpler checks with very few false positives), -mypy_, pyright_ or pyre_ (typing checks), bandit_ (security oriented checks), black_ and -isort_ (auto-formatting), autoflake_ (automated removal of unused imports or variables), -pyupgrade_ (automated upgrade to newer python syntax) and pydocstringformatter_ (automated pep257). +with builtin auto-fix and a large number of checks taken from popular linters, but +implemented in ``rust``) or flake8_ (a framework to implement your own checks in python using ``ast`` directly), +mypy_, pyright_ / pylance or pyre_ (typing checks), bandit_ (security oriented checks), black_ and +isort_ (auto-formatting), autoflake_ (automated removal of unused imports or variables), pyupgrade_ +(automated upgrade to newer python syntax) and pydocstringformatter_ (automated pep257). .. _ruff: https://github.com/charliermarsh/ruff .. _flake8: https://github.com/PyCQA/flake8 diff --git a/doc/data/messages/c/consider-using-dict-comprehension/details.rst b/doc/data/messages/c/consider-using-dict-comprehension/details.rst index c287fc4847..f23dba1e8e 100644 --- a/doc/data/messages/c/consider-using-dict-comprehension/details.rst +++ b/doc/data/messages/c/consider-using-dict-comprehension/details.rst @@ -1,3 +1,4 @@ -pyupgrade_ can fix this issue automatically. +pyupgrade_ or ruff_ can fix this issue automatically. .. _pyupgrade: https://github.com/asottile/pyupgrade +.. _ruff: https://docs.astral.sh/ruff/ diff --git a/doc/data/messages/c/consider-using-set-comprehension/details.rst b/doc/data/messages/c/consider-using-set-comprehension/details.rst index c287fc4847..f23dba1e8e 100644 --- a/doc/data/messages/c/consider-using-set-comprehension/details.rst +++ b/doc/data/messages/c/consider-using-set-comprehension/details.rst @@ -1,3 +1,4 @@ -pyupgrade_ can fix this issue automatically. +pyupgrade_ or ruff_ can fix this issue automatically. .. _pyupgrade: https://github.com/asottile/pyupgrade +.. _ruff: https://docs.astral.sh/ruff/ diff --git a/doc/whatsnew/2/2.11/summary.rst b/doc/whatsnew/2/2.11/summary.rst index 1d16bc5214..efbeea5220 100644 --- a/doc/whatsnew/2/2.11/summary.rst +++ b/doc/whatsnew/2/2.11/summary.rst @@ -6,7 +6,7 @@ Summary -- Release highlights In 2.11, we added a new default checker to advise using f-string as it's the most efficient way of formatting strings right now. You can use -`pyupgrade`_ or `flynt`_ to migrate your old ``%`` and ``format()`` automatically. +`pyupgrade`_, `ruff`_ or `flynt`_ to migrate your old ``%`` and ``format()`` automatically. We added a new extension ``SetMembershipChecker`` that will advise the use of set for membership test, as it's more performant than lists or tuples. @@ -29,7 +29,7 @@ to provide knowledge or use case :) .. _possible-forgotten-f-prefix: https://github.com/pylint-dev/pylint/pull/4787 .. _pyupgrade: https://github.com/asottile/pyupgrade .. _flynt: https://github.com/ikamensh/flynt - +.. _ruff: https://docs.astral.sh/ruff/ New checkers ============ diff --git a/pylint/checkers/base_checker.py b/pylint/checkers/base_checker.py index 3f153364ea..ab76357c49 100644 --- a/pylint/checkers/base_checker.py +++ b/pylint/checkers/base_checker.py @@ -134,9 +134,7 @@ def get_full_documentation( if reports: result += get_rst_title(f"{checker_title} Reports", "^") for report in reports: - result += ":{}: {}\n".format( # pylint: disable=consider-using-f-string - *report[:2] - ) + result += f":{report[0]}: {report[1]}\n" result += "\n" result += "\n" return result