mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 21:43:52 +00:00
Update ecosystem check headers to show unchanged project count (#9157)
Instead of displaying the total completed project count in the "changed" section of a header, we now separately calculated the changed and unchanged count to make the header message nice and clear. e.g. > ℹ️ ecosystem check **detected format changes**. (+1772 -1859 lines in 239 files in 26 projects; 6 project errors; 9 projects unchanged) and > ℹ️ ecosystem check **detected linter changes**. (+4598 -5023 violations, +0 -40 fixes in 13 projects; 4 project errors; 24 projects unchanged) Previously, it would have included the unchanged count in the first project count.
This commit is contained in:
parent
6ecf844214
commit
2c6b534e1f
2 changed files with 27 additions and 2 deletions
|
@ -28,6 +28,7 @@ def markdown_format_result(result: Result) -> str:
|
|||
lines: list[str] = []
|
||||
total_lines_removed = total_lines_added = 0
|
||||
total_files_modified = 0
|
||||
projects_with_changes = 0
|
||||
error_count = len(result.errored)
|
||||
patch_sets: list[PatchSet] = []
|
||||
|
||||
|
@ -39,6 +40,9 @@ def markdown_format_result(result: Result) -> str:
|
|||
patch_sets.append(patch_set)
|
||||
total_files_modified += len(patch_set.modified_files)
|
||||
|
||||
if comparison.diff:
|
||||
projects_with_changes += 1
|
||||
|
||||
if total_lines_removed == 0 and total_lines_added == 0 and error_count == 0:
|
||||
return "\u2705 ecosystem check detected no format changes."
|
||||
|
||||
|
@ -51,11 +55,21 @@ def markdown_format_result(result: Result) -> str:
|
|||
)
|
||||
else:
|
||||
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"
|
||||
changes = (
|
||||
f"+{total_lines_added} -{total_lines_removed} lines "
|
||||
f"in {total_files_modified} file{s} in "
|
||||
f"{projects_with_changes} projects"
|
||||
)
|
||||
|
||||
if error_count:
|
||||
s = "s" if error_count != 1 else ""
|
||||
changes += f"; {error_count} project error{s}"
|
||||
|
||||
unchanged_projects = len(result.completed) - projects_with_changes
|
||||
if unchanged_projects:
|
||||
s = "s" if unchanged_projects != 1 else ""
|
||||
changes += f"; {unchanged_projects} project{s} unchanged"
|
||||
|
||||
lines.append(
|
||||
f"\u2139\ufe0f ecosystem check **detected format changes**. ({changes})"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue