diff --git a/pyproject.toml b/pyproject.toml index 6248d0462..a57df0d24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,7 +83,7 @@ docs = [ ] lint = [ "flake8>=3.5.0", - "ruff==0.4.1", + "ruff==0.4.4", "mypy==1.10.0", "sphinx-lint", "types-docutils", diff --git a/sphinx/environment/collectors/asset.py b/sphinx/environment/collectors/asset.py index f376c297b..368e47732 100644 --- a/sphinx/environment/collectors/asset.py +++ b/sphinx/environment/collectors/asset.py @@ -108,7 +108,7 @@ class ImageCollector(EnvironmentCollector): logger.warning(__('image file %s not readable: %s'), filename, err, location=node, type='image', subtype='not_readable') for key, files in globbed.items(): - candidates[key] = sorted(files, key=len)[0] # select by similarity + candidates[key] = min(files, key=len) # select by similarity class DownloadFileCollector(EnvironmentCollector): diff --git a/sphinx/transforms/i18n.py b/sphinx/transforms/i18n.py index 4f8c3530d..88b7f416e 100644 --- a/sphinx/transforms/i18n.py +++ b/sphinx/transforms/i18n.py @@ -364,9 +364,9 @@ class Locale(SphinxTransform): for node, msg in extract_messages(self.document): msgstr = merged.get(msg, '') - # There is no point in having #noqa on literal blocks because + # There is no point in having noqa on literal blocks because # they cannot contain references. Recognizing it would just - # completely prevent escaping the #noqa. Outside of literal + # completely prevent escaping the noqa. Outside of literal # blocks, one can always write \#noqa. if not isinstance(node, LITERAL_TYPE_NODES): msgstr, _ = parse_noqa(msgstr) diff --git a/tox.ini b/tox.ini index fb7e344ff..30b334d49 100644 --- a/tox.ini +++ b/tox.ini @@ -53,3 +53,12 @@ deps = bindep commands = bindep test + +[testenv:ruff] +description = + Run ruff formatting and linting. +extras = + lint +commands = + ruff format . + ruff check --fix .