[llvm] Reland "[llvm-lit] Process ANSI color codes in test output when forma… (PR #108107)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 15:46:44 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r d14a600b1eb650f05fcd56a7b790e30f1f52e751...6a04b1f26ce36e183a44a7b822f75980e76a3521 llvm/utils/lit/tests/escape-color.py llvm/utils/lit/lit/TestRunner.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- lit/TestRunner.py	2024-09-10 22:36:55.000000 +0000
+++ lit/TestRunner.py	2024-09-10 22:46:20.892140 +0000
@@ -1019,14 +1019,14 @@
 
 def findColor(line, curr_color):
     start = line.rfind("\33[")
     if start == -1:
         return curr_color
-    end = line.find("m", start+2)
+    end = line.find("m", start + 2)
     if end == -1:
         return curr_color
-    match = line[start:end+1]
+    match = line[start : end + 1]
     # "\33[0m" means "reset all formatting". Sometimes the 0 is skipped.
     if match == "\33[m" or match == "\33[0m":
         return None
     return match
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/108107


More information about the llvm-commits mailing list