From 63d194f1273af512db2b53eccb216b5e6aa16484 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 02:07:39 +0000 Subject: [PATCH 1/3] Update prek dependencies --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2fe74794b02b2..63152168f1b5a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,7 +35,7 @@ repos: priority: 0 - repo: https://github.com/crate-ci/typos - rev: v1.43.4 + rev: v1.43.5 hooks: - id: typos priority: 0 @@ -66,7 +66,7 @@ repos: priority: 0 - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.36.1 + rev: 0.36.2 hooks: - id: check-github-workflows priority: 0 @@ -93,7 +93,7 @@ repos: priority: 0 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.1 + rev: v0.15.2 hooks: - id: ruff-format priority: 0 @@ -117,7 +117,7 @@ repos: # Priority 2: ruffen-docs runs after markdownlint-fix (both modify markdown). - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.1 + rev: v0.15.2 hooks: - id: ruff-format name: mdtest format From 4091f274e1e5078fa3fe0d86e5b68e3aef2cb296 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 2 Mar 2026 11:08:21 +0000 Subject: [PATCH 2/3] prek autofixes --- python/ruff-ecosystem/ruff_ecosystem/check.py | 7 ++++--- python/ruff-ecosystem/ruff_ecosystem/format.py | 3 ++- python/ruff-ecosystem/ruff_ecosystem/main.py | 4 ++-- python/ruff-ecosystem/ruff_ecosystem/projects.py | 2 +- python/ruff-ecosystem/ruff_ecosystem/types.py | 5 +++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/python/ruff-ecosystem/ruff_ecosystem/check.py b/python/ruff-ecosystem/ruff_ecosystem/check.py index 6babd762d4641..b444c018db806 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/check.py +++ b/python/ruff-ecosystem/ruff_ecosystem/check.py @@ -10,10 +10,11 @@ import time from asyncio import create_subprocess_exec from collections import Counter +from collections.abc import Iterable, Iterator, Sequence from dataclasses import dataclass, field from pathlib import Path from subprocess import PIPE -from typing import TYPE_CHECKING, Iterable, Iterator, Self, Sequence +from typing import TYPE_CHECKING, Self from ruff_ecosystem import logger from ruff_ecosystem.markdown import ( @@ -417,7 +418,7 @@ def try_from_string(cls: type[Self], line: str) -> Self | None: if match is None: # Handle case where there are no regex match e.g. - # + "?application=AIRFLOW&authenticator=TEST_AUTH&role=TEST_ROLE&warehouse=TEST_WAREHOUSE" # noqa: E501, ERA001 + # + "?application=AIRFLOW&authenticator=TEST_AUTH&role=TEST_ROLE&warehouse=TEST_WAREHOUSE" # Which was found in local testing return None @@ -457,7 +458,7 @@ def from_simple_diff(cls, diff: Diff) -> CheckDiff: diff = diff.without_unchanged_lines() # Sort without account for the leading + / - - sorted_lines = list(sorted(diff, key=lambda line: line[2:])) + sorted_lines = sorted(diff, key=lambda line: line[2:]) # Parse the lines, drop lines that cannot be parsed parsed_lines: list[DiagnosticLine] = list( diff --git a/python/ruff-ecosystem/ruff_ecosystem/format.py b/python/ruff-ecosystem/ruff_ecosystem/format.py index fbb561d248139..4340d6f09f3d0 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/format.py +++ b/python/ruff-ecosystem/ruff_ecosystem/format.py @@ -6,10 +6,11 @@ import time from asyncio import create_subprocess_exec +from collections.abc import Sequence from enum import Enum from pathlib import Path from subprocess import PIPE -from typing import TYPE_CHECKING, Sequence +from typing import TYPE_CHECKING from unidiff import PatchSet diff --git a/python/ruff-ecosystem/ruff_ecosystem/main.py b/python/ruff-ecosystem/ruff_ecosystem/main.py index 4a3fc95e1482a..8f792da44b04c 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/main.py +++ b/python/ruff-ecosystem/ruff_ecosystem/main.py @@ -1,9 +1,10 @@ import asyncio import dataclasses import json +from collections.abc import Awaitable from enum import Enum from pathlib import Path -from typing import Awaitable, TypeVar +from typing import TypeVar from ruff_ecosystem import logger from ruff_ecosystem.check import compare_check, markdown_check_result @@ -96,7 +97,6 @@ async def limited_parallelism(coroutine: Awaitable[T]) -> T: case _: raise ValueError(f"Unknown output format {format}") - return None async def clone_and_compare( diff --git a/python/ruff-ecosystem/ruff_ecosystem/projects.py b/python/ruff-ecosystem/ruff_ecosystem/projects.py index 38d5623159043..e25d2fd10fb94 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/projects.py +++ b/python/ruff-ecosystem/ruff_ecosystem/projects.py @@ -129,7 +129,7 @@ def patch_config( toml = {} # Do not write a toml file if it does not exist and we're just nulling values - if all((value is None for value in overrides.values())): + if all(value is None for value in overrides.values()): yield return diff --git a/python/ruff-ecosystem/ruff_ecosystem/types.py b/python/ruff-ecosystem/ruff_ecosystem/types.py index e9b9664aeea44..c3464ea4fde01 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/types.py +++ b/python/ruff-ecosystem/ruff_ecosystem/types.py @@ -3,8 +3,9 @@ import abc import dataclasses import difflib +from collections.abc import Iterable, Iterator, Sequence from dataclasses import dataclass, is_dataclass -from typing import TYPE_CHECKING, Any, Generator, Iterable, Sequence +from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from ruff_ecosystem.projects import ClonedRepository, Project @@ -46,7 +47,7 @@ def __init__(self, lines: Iterable[str], leading_spaces: int = 0) -> None: def __bool__(self) -> bool: return bool(self.added or self.removed) - def __iter__(self) -> Generator[str, None, None]: + def __iter__(self) -> Iterator[str]: yield from self.lines @property From 94c6af6ff50db503ac47c3083767b35d038c1431 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 2 Mar 2026 11:14:25 +0000 Subject: [PATCH 3/3] run prek --- python/ruff-ecosystem/pyproject.toml | 2 +- python/ruff-ecosystem/ruff_ecosystem/check.py | 4 +--- python/ruff-ecosystem/ruff_ecosystem/cli.py | 4 ++-- python/ruff-ecosystem/ruff_ecosystem/format.py | 10 +++------- python/ruff-ecosystem/ruff_ecosystem/main.py | 1 - python/ruff-ecosystem/ruff_ecosystem/types.py | 12 +++++------- 6 files changed, 12 insertions(+), 21 deletions(-) diff --git a/python/ruff-ecosystem/pyproject.toml b/python/ruff-ecosystem/pyproject.toml index 14a57a15489b0..69d5e2b7de2cc 100644 --- a/python/ruff-ecosystem/pyproject.toml +++ b/python/ruff-ecosystem/pyproject.toml @@ -12,5 +12,5 @@ dependencies = ["unidiff==0.7.5", "tomli_w==1.2.0", "tomli==2.4.0"] ruff-ecosystem = "ruff_ecosystem.cli:entrypoint" [tool.ruff.lint] -extend-select = ["I"] +ignore = ["T100"] preview = true diff --git a/python/ruff-ecosystem/ruff_ecosystem/check.py b/python/ruff-ecosystem/ruff_ecosystem/check.py index b444c018db806..b01faa3ff553e 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/check.py +++ b/python/ruff-ecosystem/ruff_ecosystem/check.py @@ -560,10 +560,8 @@ async def ruff_check( raise ToolError(err.decode("utf8")) # Strip summary lines so the diff is only diagnostic lines - lines = [ + return [ line for line in result.decode("utf8").splitlines() if not CHECK_SUMMARY_LINE_RE.match(line) ] - - return lines diff --git a/python/ruff-ecosystem/ruff_ecosystem/cli.py b/python/ruff-ecosystem/ruff_ecosystem/cli.py index b996504c22b21..faf324d5f101d 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/cli.py +++ b/python/ruff-ecosystem/ruff_ecosystem/cli.py @@ -54,7 +54,7 @@ def entrypoint(): f"Could not find ruff baseline executable: {args.baseline_executable}", sys.stderr, ) - exit(1) + sys.exit(1) logger.info( "Resolved baseline executable %s to %s", args.baseline_executable, @@ -69,7 +69,7 @@ def entrypoint(): f"Could not find ruff comparison executable: {args.comparison_executable}", sys.stderr, ) - exit(1) + sys.exit(1) logger.info( "Resolved comparison executable %s to %s", args.comparison_executable, diff --git a/python/ruff-ecosystem/ruff_ecosystem/format.py b/python/ruff-ecosystem/ruff_ecosystem/format.py index 4340d6f09f3d0..b503a51dc6dc1 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/format.py +++ b/python/ruff-ecosystem/ruff_ecosystem/format.py @@ -183,7 +183,7 @@ async def format_then_format( options=options, ) # Then get the diff from stdout - diff = await format( + return await format( formatter=Formatter.ruff, executable=ruff_comparison_executable.resolve(), path=cloned_repo.path, @@ -191,7 +191,6 @@ async def format_then_format( options=options, diff=True, ) - return diff async def format_and_format( @@ -230,9 +229,7 @@ async def format_and_format( ) # Then get the diff from the commit - diff = await cloned_repo.diff(commit) - - return diff + return await cloned_repo.diff(commit) async def format( @@ -272,8 +269,7 @@ async def format( if proc.returncode not in [0, 1]: raise ToolError(err.decode("utf8")) - lines = result.decode("utf8").splitlines() - return lines + return result.decode("utf8").splitlines() class FormatComparison(Enum): diff --git a/python/ruff-ecosystem/ruff_ecosystem/main.py b/python/ruff-ecosystem/ruff_ecosystem/main.py index 8f792da44b04c..b2573fd3a9fc0 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/main.py +++ b/python/ruff-ecosystem/ruff_ecosystem/main.py @@ -98,7 +98,6 @@ async def limited_parallelism(coroutine: Awaitable[T]) -> T: raise ValueError(f"Unknown output format {format}") - async def clone_and_compare( command: RuffCommand, baseline_executable: Path, diff --git a/python/ruff-ecosystem/ruff_ecosystem/types.py b/python/ruff-ecosystem/ruff_ecosystem/types.py index c3464ea4fde01..e3e2fcf3659e5 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/types.py +++ b/python/ruff-ecosystem/ruff_ecosystem/types.py @@ -29,20 +29,20 @@ def __init__(self, lines: Iterable[str], leading_spaces: int = 0) -> None: self.lines = list(lines) # Compute added and removed lines once - self.added = list( + self.added = [ line[2:] for line in self.lines if line.startswith("+" + " " * leading_spaces) # Do not include patch headers and not line.startswith("+++") - ) - self.removed = list( + ] + self.removed = [ line[2:] for line in self.lines if line.startswith("-" + " " * leading_spaces) # Do not include patch headers and not line.startswith("---") - ) + ] def __bool__(self) -> bool: return bool(self.added or self.removed) @@ -66,9 +66,7 @@ def from_pair(cls, baseline: Sequence[str], comparison: Sequence[str]): return cls(difflib.ndiff(baseline, comparison), leading_spaces=1) def without_unchanged_lines(self) -> Diff: - return Diff( - line for line in self.lines if line.startswith("+") or line.startswith("-") - ) + return Diff(line for line in self.lines if line.startswith(("+", "-"))) def jsonable(self) -> Any: return self.lines