[llvm] [Github] Fix comment formatting for code format action (PR #75764)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 21 22:10:36 PST 2023
https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/75764
>From 946e41a8de118cc5cf0ffa73e931846dadbf7ca9 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Mon, 18 Dec 2023 03:21:16 +0000
Subject: [PATCH] [Github] Fix comment formatting for code format action
Before this patch, there was a regression in comment formatting due to
some code formatting in bd3e8eb6e325081bf7cfbe93652aa825de3170e5. Github
interprets a tab before a string as starting code formatting. The
message that indicted the code formatting in a PR had been fixed was
refactored to a python multi-line string, but with a tab in front,
causing these messages to be rendered as code blocks in Github, instead
of as intended. This patch changes this back to a single line string to
prevent this issue.
---
llvm/utils/git/code-format-helper.py | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index 849ae996f7339f..8a29a57d8d16bd 100755
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -130,9 +130,10 @@ def run(self, changed_files: List[str], args: FormatArgs) -> bool:
if diff is None:
if should_update_gh:
- comment_text = f"""
-:white_check_mark: With the latest revision this PR passed the {self.friendly_name}.
-"""
+ comment_text = (
+ ":white_check_mark: With the latest revision "
+ f"this PR passed the {self.friendly_name}."
+ )
self.update_pr(comment_text, args, create_new=False)
return True
elif len(diff) > 0:
@@ -141,15 +142,17 @@ def run(self, changed_files: List[str], args: FormatArgs) -> bool:
self.update_pr(comment_text, args, create_new=True)
else:
print(
- f"Warning: {self.friendly_name}, {self.name} detected some issues with your code formatting..."
+ f"Warning: {self.friendly_name}, {self.name} detected "
+ "some issues with your code formatting..."
)
return False
else:
# The formatter failed but didn't output a diff (e.g. some sort of
# infrastructure failure).
- comment_text = f"""
-:warning: The {self.friendly_name} failed without printing a diff. Check the logs for stderr output. :warning:
-"""
+ comment_text = (
+ f":warning: The {self.friendly_name} failed without printing "
+ "a diff. Check the logs for stderr output. :warning:"
+ )
self.update_pr(comment_text, args, create_new=False)
return False
More information about the llvm-commits
mailing list