mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 05:44:56 +00:00
Only show ecosystem command used if options are non-default (#8435)
To save that precious character count
This commit is contained in:
parent
d350ede992
commit
0d93fbb4a2
1 changed files with 11 additions and 6 deletions
|
@ -11,9 +11,13 @@ def markdown_project_section(
|
||||||
) -> list[str]:
|
) -> list[str]:
|
||||||
return markdown_details(
|
return markdown_details(
|
||||||
summary=f'<a href="{project.repo.url}">{project.repo.fullname}</a> ({title})',
|
summary=f'<a href="{project.repo.url}">{project.repo.fullname}</a> ({title})',
|
||||||
# Show the command used for the check
|
|
||||||
preface="<pre>ruff " + " ".join(options.to_ruff_args()) + "</pre>",
|
|
||||||
content=content,
|
content=content,
|
||||||
|
preface=(
|
||||||
|
# Show the command used for the check if the options are non-default
|
||||||
|
"<pre>ruff " + " ".join(options.to_ruff_args()) + "</pre>"
|
||||||
|
if options != type(options)()
|
||||||
|
else None
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,9 +28,10 @@ def markdown_plus_minus(added: int, removed: int) -> str:
|
||||||
return f"+{added} -{removed}"
|
return f"+{added} -{removed}"
|
||||||
|
|
||||||
|
|
||||||
def markdown_details(summary: str, preface: str, content: str | list[str]):
|
def markdown_details(summary: str, content: str | list[str], preface: str):
|
||||||
lines = []
|
lines = []
|
||||||
lines.append(f"<details><summary>{summary}</summary>")
|
lines.append(f"<details><summary>{summary}</summary>")
|
||||||
|
if preface:
|
||||||
lines.append("<p>")
|
lines.append("<p>")
|
||||||
lines.append(preface)
|
lines.append(preface)
|
||||||
lines.append("</p>")
|
lines.append("</p>")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue