MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / run

Method run

External/code-format-helper/code-format-helper.py:137–168  ·  view source on GitHub ↗
(self, changed_files: List[str], args: FormatArgs)

Source from the content-addressed store, hash-verified

135 pr.as_issue().create_comment(comment_text)
136
137 def run(self, changed_files: List[str], args: FormatArgs) -> bool:
138 changed_files = [arg for arg in changed_files if "third-party" not in arg]
139 diff = self.format_run(changed_files, args)
140 should_update_gh = args.token is not None and args.repo is not None
141
142 if diff is None:
143 if should_update_gh:
144 comment_text = (
145 ":white_check_mark: With the latest revision "
146 f"this PR passed the {self.friendly_name}."
147 )
148 self.update_pr(comment_text, args, create_new=False)
149 return True
150 elif len(diff) > 0:
151 if should_update_gh:
152 comment_text = self.pr_comment_text_for_diff(diff)
153 self.update_pr(comment_text, args, create_new=True)
154 else:
155 print(
156 f"Warning: {self.friendly_name}, {self.name} detected "
157 "some issues with your code formatting..."
158 )
159 return False
160 else:
161 # The formatter failed but didn't output a diff (e.g. some sort of
162 # infrastructure failure).
163 comment_text = (
164 f":warning: The {self.friendly_name} failed without printing "
165 "a diff. Check the logs for stderr output. :warning:"
166 )
167 self.update_pr(comment_text, args, create_new=False)
168 return False
169
170
171class ClangFormatHelper(FormatHelper):

Callers 4

has_toolMethod · 0.45
format_runMethod · 0.45
hook_mainFunction · 0.45

Calls 4

format_runMethod · 0.95
update_prMethod · 0.95
printFunction · 0.85

Tested by

no test coverage detected