From 85de1e97e2055f5f8d6b2c07abe2f4b598eb2cf2 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 26 Oct 2023 16:26:01 -0500 Subject: [PATCH] Add completed project count to summary title --- python/ruff-ecosystem/ruff_ecosystem/check.py | 10 +++++++--- python/ruff-ecosystem/ruff_ecosystem/format.py | 13 +++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/python/ruff-ecosystem/ruff_ecosystem/check.py b/python/ruff-ecosystem/ruff_ecosystem/check.py index cd5225257a..d68a3323de 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/check.py +++ b/python/ruff-ecosystem/ruff_ecosystem/check.py @@ -72,10 +72,14 @@ def markdown_check_result(result: Result) -> str: return "\u2705 ecosystem check detected no linter changes." # Summarize the total changes - s = "s" if error_count != 1 else "" - changes = f"(+{total_added} -{total_removed} violations, +{total_added_fixes} -{total_removed_fixes} fixes, {error_count} error{s})" + changes = f"+{total_added} -{total_removed} violations, +{total_added_fixes} -{total_removed_fixes} fixes in {len(result.completed)} projects" + if error_count: + s = "s" if error_count != 1 else "" + changes += f"; {error_count} project error{s}" - lines.append(f"\u2139\ufe0f ecosystem check **detected linter changes**. {changes}") + lines.append( + f"\u2139\ufe0f ecosystem check **detected linter changes**. ({changes})" + ) lines.append("") # Limit the number of items displayed per rule to between 5 and 200 diff --git a/python/ruff-ecosystem/ruff_ecosystem/format.py b/python/ruff-ecosystem/ruff_ecosystem/format.py index 8be240eb98..17e7efcbb7 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/format.py +++ b/python/ruff-ecosystem/ruff_ecosystem/format.py @@ -44,10 +44,15 @@ def markdown_format_result(result: Result) -> str: return "\u2705 ecosystem check detected no format changes." # Summarize the total changes - es = "s" if error_count != 1 else "" - fs = "s" if total_files_modified != 1 else "" - changes = f"(+{total_lines_added}, -{total_lines_removed} lines in {total_files_modified} file{fs}, {error_count} error{es})" - lines.append(f"\u2139\ufe0f ecosystem check **detected format changes**. {changes}") + s = "s" if total_files_modified != 1 else "" + changes = f"+{total_lines_added} -{total_lines_removed} lines in {total_files_modified} file{s} in {len(result.completed)} projects" + if error_count: + s = "s" if error_count != 1 else "" + changes += f"; {error_count} project error{s}" + + lines.append( + f"\u2139\ufe0f ecosystem check **detected format changes**. ({changes})" + ) lines.append("") # Then per-project changes