Skip to content

Commit d5f45bb

Browse files
zeyi2EugeneZelenko
andauthored
Apply suggestions from code review
Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
1 parent 4b0b1ee commit d5f45bb

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,10 @@ class Doc8LintHelper(LintHelper):
295295
name: Final = "doc8"
296296
friendly_name: Final = "documentation linter"
297297

298-
def instructions(self, files_to_lint: Sequence[str], args: LintArgs) -> str:
299-
files_str = " ".join(files_to_lint)
300-
return f"doc8 -q {files_str}"
298+
def instructions(self, files_to_lint: Iterable[str], args: LintArgs) -> str:
299+
return f"doc8 -q {' '.join(files_to_lint)}"
301300

302-
def filter_changed_files(self, changed_files: Sequence[str]) -> Sequence[str]:
301+
def filter_changed_files(self, changed_files: Iterable[str]) -> Sequence[str]:
303302
filtered_files = []
304303
for filepath in changed_files:
305304
_, ext = os.path.splitext(filepath)
@@ -311,7 +310,7 @@ def filter_changed_files(self, changed_files: Sequence[str]) -> Sequence[str]:
311310
filtered_files.append(filepath)
312311
return filtered_files
313312

314-
def run_linter_tool(self, files_to_lint: Sequence[str], args: LintArgs) -> str:
313+
def run_linter_tool(self, files_to_lint: Iterable[str], args: LintArgs) -> str:
315314
if not files_to_lint:
316315
return ""
317316

@@ -332,12 +331,10 @@ def run_linter_tool(self, files_to_lint: Sequence[str], args: LintArgs) -> str:
332331
if proc.returncode == 0:
333332
return ""
334333

335-
output = proc.stdout.strip()
336-
if output:
334+
if output := proc.stdout.strip():
337335
return output
338336

339-
error_output = proc.stderr.strip()
340-
if error_output:
337+
if error_output := proc.stderr.strip():
341338
return error_output
342339

343340
return f"doc8 exited with return code {proc.returncode} but no output."

0 commit comments

Comments
 (0)