[llvm] fc3eed1 - [Github] Reformat strings for code format action (#75764)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 21 22:49:09 PST 2023
Author: Aiden Grossman
Date: 2023-12-21T22:49:04-08:00
New Revision: fc3eed1bce0322fcfd9726b9f2ba747cb9c63802
URL: https://github.com/llvm/llvm-project/commit/fc3eed1bce0322fcfd9726b9f2ba747cb9c63802
DIFF: https://github.com/llvm/llvm-project/commit/fc3eed1bce0322fcfd9726b9f2ba747cb9c63802.diff
LOG: [Github] Reformat strings for code format action (#75764)
Before this patch, there was a regression in comment formatting due to
some code formatting in bd3e8eb6e325081bf7cfbe93652aa825de3170e5. This
was fixed in 428660cfb986dd0a59cd2a16972c5f7109080522. 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 builds upon the original fix to reformat the
strings so that they fit within ~80 character lines and are simpler to
modify in the future, hopefully removing traps like the one that caused
the original issue.
Added:
Modified:
llvm/utils/git/code-format-helper.py
Removed:
################################################################################
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