================
@@ -124,133 +96,260 @@ def create_comment_text(warning: str, cpp_files: 
List[str]) -> str:
 
 <details>
 <summary>
-View the output from clang-tidy here.
+View the output from {self.name} here.
 </summary>
 
 ```
-{warning}
+{linter_output}
 ```
 
 </details>
 """
 
+    # TODO: Refactor this
+    def find_comment(self, pr: any) -> any:
+        all_linter_names = list(map(attrgetter("name"), ALL_LINTERS))
+        other_linter_names = [name for name in all_linter_names if name != 
self.name]
+
+        other_tags = [
+            self.COMMENT_TAG.format(linter=name) for name in other_linter_names
+        ]
+
+        for comment in pr.as_issue().get_comments():
+            body = comment.body
+            if self.comment_tag in body and not any(
+                other_tag in body for other_tag in other_tags
+            ):
+                return comment
+        return None
 
-def find_comment(pr: any) -> any:
-    for comment in pr.as_issue().get_comments():
-        if COMMENT_TAG in comment.body:
-            return comment
-    return None
+    def update_pr(self, comment_text: str, args: LintArgs, create_new: bool) 
-> None:
+        import github
+        from github import IssueComment, PullRequest
----------------
EugeneZelenko wrote:

I would place all imports at the top.

https://github.com/llvm/llvm-project/pull/168827
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to