(self, changed_files: List[str], args: FormatArgs)
| 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 | |
| 171 | class ClangFormatHelper(FormatHelper): |
no test coverage detected