================
@@ -289,8 +291,71 @@ def _clean_clang_tidy_output(self, output: str) -> str:
         return ""
 
 
+class Doc8LintHelper(LintHelper):
+    name: Final = "doc8"
+    friendly_name: Final = "RST documentation linter"
 
-ALL_LINTERS = (ClangTidyLintHelper(),)
+    def instructions(self, files_to_lint: Iterable[str], args: LintArgs) -> 
str:
+        return f"doc8 -q {' '.join(files_to_lint)}"
+
+    def create_comment_text(
+        self, linter_output: str, files_to_lint: Sequence[str], args: LintArgs
+    ) -> str:
+        comment = super().create_comment_text(linter_output, files_to_lint, 
args)
+        if "D001" in linter_output or "Line too long" in linter_output:
+            parts = comment.rsplit("</details>", 1)
+            if len(parts) == 2:
+                return (
+                    parts[0]
+                    + "\nNote: documentation lines should be no more than 79 
characters wide.\n</details>"
----------------
vbvictor wrote:

Hm, I tested and
```
len("The `google-readability-braces-around-statements` check is an alias, 
please see") // 79
// doc8 doesn't flag it
```
But if I look at the VS Code column count, it says `Ln8, Col 80` if my cursor 
is placed after `e` char.

So could we have a round number here and say
"documentation lines should be less than 80 characters wide" (not less-equal). 
Imho writing 79 is a bit awkward.

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

Reply via email to