mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:09:22 +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]:
|
||||
return markdown_details(
|
||||
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,
|
||||
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,12 +28,13 @@ def markdown_plus_minus(added: int, removed: int) -> str:
|
|||
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.append(f"<details><summary>{summary}</summary>")
|
||||
lines.append("<p>")
|
||||
lines.append(preface)
|
||||
lines.append("</p>")
|
||||
if preface:
|
||||
lines.append("<p>")
|
||||
lines.append(preface)
|
||||
lines.append("</p>")
|
||||
lines.append("<p>")
|
||||
lines.append("")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue