================
@@ -48,68 +51,33 @@ def __init__(self, args: argparse.Namespace = None) -> None:
             self.clang_tidy_binary = args.clang_tidy_binary
 
 
-COMMENT_TAG = "<!--LLVM CODE LINT COMMENT: clang-tidy-->"
+class LintHelper:
+    COMMENT_TAG = "<!--LLVM CODE LINT COMMENT: {linter}-->"
+    name: str
+    friendly_name: str
+    comment: Optional[Dict[str, Any]] = None
 
+    @property
+    def comment_tag(self) -> str:
+        return self.COMMENT_TAG.format(linter=self.name)
 
-def get_instructions(cpp_files: List[str]) -> str:
-    files_str = " ".join(cpp_files)
-    return f"""
-git diff -U0 origin/main...HEAD -- {files_str} |
-python3 clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py \\
-  -path build -p1 -quiet"""
-
-
-def clean_clang_tidy_output(output: str) -> Optional[str]:
-    """
-    - Remove 'Running clang-tidy in X threads...' line
-    - Remove 'N warnings generated.' line
-    - Strip leading workspace path from file paths
-    """
-    if not output or output == "No relevant changes found.":
-        return None
-
-    lines = output.split("\n")
-    cleaned_lines = []
-
-    for line in lines:
-        if line.startswith("Running clang-tidy in") or 
line.endswith("generated."):
-            continue
-
-        # Remove everything up to rightmost "llvm-project/" for correct files 
names
-        idx = line.rfind("llvm-project/")
-        if idx != -1:
-            line = line[idx + len("llvm-project/") :]
-
-        cleaned_lines.append(line)
-
-    if cleaned_lines:
-        return "\n".join(cleaned_lines)
-    return None
-
+    def instructions(self, files_to_lint: List[str], args: LintArgs) -> str:
----------------
zeyi2 wrote:

Sorry I forgot the Python requirements again, I'll fix it soon.

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