[llvm] [Github][CI] Add `doc8` for clang-tidy documentation formatting (PR #168827)
Baranov Victor via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 20 04:24:08 PST 2025
================
@@ -215,7 +235,125 @@ def run_clang_tidy(changed_files: List[str], args: LintArgs) -> Optional[str]:
return clean_clang_tidy_output(proc.stdout.strip())
-def run_linter(changed_files: List[str], args: LintArgs) -> tuple[bool, Optional[dict]]:
+def clean_doc8_output(output: str) -> Optional[str]:
+ if not output:
+ return None
+
+ lines = output.split("\n")
+ cleaned_lines = []
+ in_summary = False
+
+ for line in lines:
+ if line.startswith("Scanning...") or line.startswith("Validating..."):
+ continue
+ if line.startswith("========"):
+ in_summary = True
+ continue
+ if in_summary:
+ continue
+ if line.strip():
+ cleaned_lines.append(line)
+
+ if cleaned_lines:
+ return "\n".join(cleaned_lines)
+ return None
+
+
+def get_doc8_instructions() -> str:
+ # TODO: use git diff
+ return "doc8 ./clang-tools-extra/docs/clang-tidy/checks/"
----------------
vbvictor wrote:
Should implement it in the end, it should be easy because we have `changed_files` already passed as argument - just check if one of the file there starts with "/clang-tools-extra/docs/clang-tidy/checks/".
Look at how clang-tidy handle it: `--changed-files "$CHANGED_FILES"`
https://github.com/llvm/llvm-project/pull/168827
More information about the llvm-commits
mailing list