diff --git a/pyproject.toml b/pyproject.toml index ea8ef46a1..1e7dde11e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,6 +139,7 @@ remove_redundant_aliases = true [tool.ruff] target-version = "py38" # Pin Ruff to Python 3.8 line-length = 95 +show-source = true exclude = [ ".git", ".tox", @@ -284,11 +285,17 @@ select = [ "doc/conf.py" = ["INP001"] "doc/development/tutorials/examples/*" = ["INP001"] +# Ruff false positive: https://github.com/charliermarsh/ruff/issues/3830 +"sphinx/domains/c.py" = ["SIM222"] + "sphinx/environment/collectors/toctree.py" = ["B026"] "sphinx/environment/adapters/toctree.py" = ["B026"] "tests/*" = ["E501"] +# Ruff false positive: https://github.com/charliermarsh/ruff/issues/3831 +"tests/test_config.py" = ["B018"] + [tool.ruff.flake8-quotes] inline-quotes = "single" diff --git a/sphinx/application.py b/sphinx/application.py index 41aa785d0..1b8bc8e3c 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -943,7 +943,7 @@ class Sphinx: refs: `Transform Priority Range Categories`__ __ https://docutils.sourceforge.io/docs/ref/transforms.html#transform-priority-range-categories - """ # noqa: E501 + """ # NoQA: E501,RUF100 # Flake8 thinks the URL is too long, Ruff special cases URLs. self.registry.add_transform(transform) def add_post_transform(self, transform: type[Transform]) -> None: diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index 5047f9b28..a7d16aa06 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -5061,7 +5061,7 @@ class Symbol: if parentSymbol.declaration is not None: if parentSymbol.declaration.objectType == 'templateParam': raise QualifiedSymbolIsTemplateParam() - return None # NoQA: RET501,PLR1711 + return None try: lookupResult = self._symbol_lookup(nestedName, templateDecls, diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index 3bce03ac6..d194f0eeb 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -323,7 +323,8 @@ class TextWrapper(textwrap.TextWrapper): if w == 1: chunks.extend(split(''.join(g))) else: - chunks.extend(list(g)) + # Ruff false positive: https://github.com/charliermarsh/ruff/issues/3829 + chunks.extend(list(g)) # NoQA: B031 return chunks def _handle_long_word(self, reversed_chunks: list[str], cur_line: list[str], diff --git a/tests/test_util_typing.py b/tests/test_util_typing.py index f55ed4ad7..c156e75ff 100644 --- a/tests/test_util_typing.py +++ b/tests/test_util_typing.py @@ -169,7 +169,7 @@ def test_restify_type_hints_alias(): def test_restify_type_ForwardRef(): from typing import ForwardRef # type: ignore - assert restify(ForwardRef("myint")) == ":py:class:`myint`" # NoQA: F821 + assert restify(ForwardRef("myint")) == ":py:class:`myint`" def test_restify_type_Literal():