From b76b4b601676152d729ec40ef5acec44ed03b800 Mon Sep 17 00:00:00 2001 From: Calum Young <32770960+calumy@users.noreply.github.com> Date: Thu, 11 May 2023 15:33:15 +0100 Subject: [PATCH] List rule changes in ecosystem (#4371) * Count changes for each rule * Handle case where rule matches were found in a line * List and sort by changes * Remove detail from rule changes * Add comment about leading : * Only print rule changes if rule changes are present * Use re.search and match group * Remove dict().items() * Use match group to extract rule code --- scripts/check_ecosystem.py | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/scripts/check_ecosystem.py b/scripts/check_ecosystem.py index 1a68bb917e..acc3e5583c 100755 --- a/scripts/check_ecosystem.py +++ b/scripts/check_ecosystem.py @@ -255,6 +255,7 @@ async def main(*, ruff1: Path, ruff2: Path, projects_jsonl: Optional[Path]) -> N if total_removed == 0 and total_added == 0 and errors == 0: print("\u2705 ecosystem check detected no changes.") else: + rule_changes: dict[str, tuple[int, int]] = {} changes = f"(+{total_added}, -{total_removed}, {errors} error(s))" print(f"\u2139\ufe0f ecosystem check **detected changes**. {changes}") @@ -294,9 +295,47 @@ async def main(*, ruff1: Path, ruff2: Path, projects_jsonl: Optional[Path]) -> N print() print("
") print("") + + # Count rule changes + for line in diff_str.splitlines(): + # Find rule change for current line or construction + # +