From: Aarni Koskela Date: Thu, 11 Jul 2024 05:53:43 +0000 (+0300) Subject: Upgrade pre-commit tools, fix ruff issues X-Git-Tag: v2.16.0~16 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=3edf7729b0d395cbba3ad17b9a28373602c9b068;p=thirdparty%2Fbabel.git Upgrade pre-commit tools, fix ruff issues --- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6c6554a5..d43cc779 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.291 + rev: v0.5.1 hooks: - id: ruff args: - --fix - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-docstring-first diff --git a/babel/plural.py b/babel/plural.py index 3be412f6..5c828d60 100644 --- a/babel/plural.py +++ b/babel/plural.py @@ -360,8 +360,7 @@ def tokenize_rule(s: str) -> list[tuple[str, str]]: result.append((tok, match.group())) break else: - raise RuleError('malformed CLDR pluralization rule. ' - 'Got unexpected %r' % s[pos]) + raise RuleError(f"malformed CLDR pluralization rule. Got unexpected {s[pos]!r}") return result[::-1] diff --git a/pyproject.toml b/pyproject.toml index 5621c2eb..ba0e4771 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,10 @@ [tool.ruff] target-version = "py38" +extend-exclude = [ + "tests/messages/data", +] + +[tool.ruff.lint] select = [ "B", "C", @@ -16,9 +21,8 @@ ignore = [ "E731", # Do not assign a lambda expression (we use them on purpose) "E741", # Ambiguous variable name "UP012", # "utf-8" is on purpose + "UP031", # A bunch of places where % formatting is better ] -extend-exclude = [ - "tests/messages/data", -] -[tool.ruff.per-file-ignores] + +[tool.ruff.lint.per-file-ignores] "scripts/import_cldr.py" = ["E402"] diff --git a/tests/messages/test_setuptools_frontend.py b/tests/messages/test_setuptools_frontend.py index 825d214f..f3686a8b 100644 --- a/tests/messages/test_setuptools_frontend.py +++ b/tests/messages/test_setuptools_frontend.py @@ -26,8 +26,8 @@ def test_extract_distutils_keyword_arg_388(kwarg, expected): # hence `--keyword ignored` will actually never end up in the output. cmdline = ( - "extract_messages --no-default-keywords --keyword ignored --keyword '%s' " - "--input-dirs . --output-file django233.pot --add-comments Bar,Foo" % kwarg + f"extract_messages --no-default-keywords --keyword ignored --keyword '{kwarg}' " + "--input-dirs . --output-file django233.pot --add-comments Bar,Foo" ) d = Distribution(attrs={ "cmdclass": setuptools_frontend.COMMANDS,