mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:14: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
|
@ -52,6 +52,8 @@ def markdown_check_result(result: Result) -> str:
|
|||
"""
|
||||
Render a `ruff check` ecosystem check result as markdown.
|
||||
"""
|
||||
projects_with_changes = 0
|
||||
|
||||
# Calculate the total number of rule changes
|
||||
all_rule_changes = RuleChanges()
|
||||
project_diffs = {
|
||||
|
@ -63,6 +65,9 @@ def markdown_check_result(result: Result) -> str:
|
|||
project_rule_changes[project] = changes = RuleChanges.from_diff(diff)
|
||||
all_rule_changes.update(changes)
|
||||
|
||||
if diff:
|
||||
projects_with_changes += 1
|
||||
|
||||
lines: list[str] = []
|
||||
total_removed = all_rule_changes.total_removed_violations()
|
||||
total_added = all_rule_changes.total_added_violations()
|
||||
|
@ -88,11 +93,17 @@ def markdown_check_result(result: Result) -> str:
|
|||
change_summary = (
|
||||
f"{markdown_plus_minus(total_added, total_removed)} violations, "
|
||||
f"{markdown_plus_minus(total_added_fixes, total_removed_fixes)} fixes "
|
||||
f"in {len(result.completed)} projects"
|
||||
f"in {projects_with_changes} projects"
|
||||
)
|
||||
if error_count:
|
||||
s = "s" if error_count != 1 else ""
|
||||
change_summary += f"; {error_count} project error{s}"
|
||||
|
||||
unchanged_projects = len(result.completed) - projects_with_changes
|
||||
if unchanged_projects:
|
||||
s = "s" if unchanged_projects != 1 else ""
|
||||
change_summary += f"; {unchanged_projects} project{s} unchanged"
|
||||
|
||||
lines.append(
|
||||
f"\u2139\ufe0f ecosystem check **detected linter changes**. ({change_summary})"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue