Skip to content

Commit 0d93fbb

Browse files
authored
Only show ecosystem command used if options are non-default (astral-sh#8435)
To save that precious character count
1 parent d350ede commit 0d93fbb

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎python/ruff-ecosystem/ruff_ecosystem/markdown.py‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ def markdown_project_section(
1111
) -> list[str]:
1212
return markdown_details(
1313
summary=f'<a href="{project.repo.url}">{project.repo.fullname}</a> ({title})',
14-
# Show the command used for the check
15-
preface="<pre>ruff " + " ".join(options.to_ruff_args()) + "</pre>",
1614
content=content,
15+
preface=(
16+
# Show the command used for the check if the options are non-default
17+
"<pre>ruff " + " ".join(options.to_ruff_args()) + "</pre>"
18+
if options != type(options)()
19+
else None
20+
),
1721
)
1822

1923

@@ -24,12 +28,13 @@ def markdown_plus_minus(added: int, removed: int) -> str:
2428
return f"+{added} -{removed}"
2529

2630

27-
def markdown_details(summary: str, preface: str, content: str | list[str]):
31+
def markdown_details(summary: str, content: str | list[str], preface: str):
2832
lines = []
2933
lines.append(f"<details><summary>{summary}</summary>")
30-
lines.append("<p>")
31-
lines.append(preface)
32-
lines.append("</p>")
34+
if preface:
35+
lines.append("<p>")
36+
lines.append(preface)
37+
lines.append("</p>")
3338
lines.append("<p>")
3439
lines.append("")
3540

0 commit comments

Comments
 (0)