Skip to content

Commit 342cae4

Browse files
committed
~
1 parent f3cb4bb commit 342cae4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

llvm/utils/git/code-lint-helper.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class LintArgs:
3636
clang_tidy_binary: str = "clang-tidy"
3737
doc8_binary: str = "doc8"
3838

39-
def __init__(self, args: argparse.Namespace = None) -> None:
39+
def __init__(self, args: argparse.Namespace) -> None:
4040
if not args is None:
4141
self.start_rev = args.start_rev
4242
self.end_rev = args.end_rev
@@ -315,9 +315,18 @@ def run_linter_tool(self, doc_files: List[str], args: LintArgs) -> Optional[str]
315315
check=False,
316316
)
317317

318+
if proc.returncode == 0:
319+
return None
320+
318321
output = proc.stdout.strip()
319-
if proc.returncode != 0 and not output:
320-
return proc.stderr.strip()
322+
if output:
323+
return output
324+
325+
error_output = proc.stderr.strip()
326+
if error_output:
327+
return error_output
328+
329+
return f"doc8 exited with return code {proc.returncode} but no output."
321330

322331

323332
ALL_LINTERS = (ClangTidyLintHelper(), Doc8LintHelper())

0 commit comments

Comments
 (0)