Skip to content

Commit da783fc

Browse files
committed
~
1 parent f6eac19 commit da783fc

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,21 @@ class LintHelper:
6161
def comment_tag(self) -> str:
6262
return self.COMMENT_TAG.format(linter=self.name)
6363

64-
def instructions(self) -> str:
64+
def instructions(self, files_to_lint: List[str], args: LintArgs) -> str:
6565
raise NotImplementedError()
6666

67-
def filter_changed_files(self) -> List[str]:
67+
def filter_changed_files(self, changed_files: List[str]) -> List[str]:
6868
raise NotImplementedError()
6969

70-
def run_linter_tool(self) -> Optional[str]:
70+
def run_linter_tool(
71+
self, files_to_lint: List[str], args: LintArgs
72+
) -> Optional[str]:
7173
raise NotImplementedError()
7274

73-
def create_comment_text(self, linter_output: str) -> str:
74-
instructions = self.instructions()
75+
def create_comment_text(
76+
self, linter_output: str, files_to_lint: List[str], args: LintArgs
77+
) -> str:
78+
instructions = self.instructions(files_to_lint, args)
7579
return f"""
7680
:warning: {self.friendly_name}, {self.name} found issues in your code. :warning:
7781
@@ -134,7 +138,7 @@ def run(self, changed_files: List[str], args: LintArgs) -> bool:
134138
if args.verbose:
135139
print(f"got changed files: {changed_files}")
136140

137-
files_to_lint = self.filter_changed_files()
141+
files_to_lint = self.filter_changed_files(changed_files)
138142

139143
if not files_to_lint and args.verbose:
140144
print("no modified files found")
@@ -143,7 +147,7 @@ def run(self, changed_files: List[str], args: LintArgs) -> bool:
143147
linter_output = None
144148

145149
if files_to_lint:
146-
linter_output = self.run_linter_tool()
150+
linter_output = self.run_linter_tool(files_to_lint, args)
147151
if linter_output:
148152
is_success = False
149153

@@ -160,7 +164,9 @@ def run(self, changed_files: List[str], args: LintArgs) -> bool:
160164
else:
161165
if should_update_gh:
162166
if linter_output:
163-
comment_text = self.create_comment_text(linter_output)
167+
comment_text = self.create_comment_text(
168+
linter_output, files_to_lint, args
169+
)
164170
self.update_pr(comment_text, args, create_new=True)
165171
else:
166172
# The linter failed but didn't output a result (e.g. some sort of

0 commit comments

Comments
 (0)