From 0d93fbb4a21e00dc9bee212a2dddcdaeaf95eda2 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 2 Nov 2023 08:53:33 -0500 Subject: [PATCH] Only show ecosystem command used if options are non-default (#8435) To save that precious character count --- .../ruff-ecosystem/ruff_ecosystem/markdown.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/python/ruff-ecosystem/ruff_ecosystem/markdown.py b/python/ruff-ecosystem/ruff_ecosystem/markdown.py index 602341ca39..e6f6060695 100644 --- a/python/ruff-ecosystem/ruff_ecosystem/markdown.py +++ b/python/ruff-ecosystem/ruff_ecosystem/markdown.py @@ -11,9 +11,13 @@ def markdown_project_section( ) -> list[str]: return markdown_details( summary=f'{project.repo.fullname} ({title})', - # Show the command used for the check - preface="
ruff " + " ".join(options.to_ruff_args()) + "
", content=content, + preface=( + # Show the command used for the check if the options are non-default + "
ruff " + " ".join(options.to_ruff_args()) + "
" + 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"
{summary}") - lines.append("

") - lines.append(preface) - lines.append("

") + if preface: + lines.append("

") + lines.append(preface) + lines.append("

") lines.append("

") lines.append("")