@@ -44,7 +44,6 @@ class FormatArgs:
44
44
token : str = None
45
45
verbose : bool = True
46
46
issue_number : int = 0
47
- write_comment_to_file : bool = False
48
47
49
48
def __init__ (self , args : argparse .Namespace = None ) -> None :
50
49
if not args is None :
@@ -54,14 +53,12 @@ def __init__(self, args: argparse.Namespace = None) -> None:
54
53
self .token = args .token
55
54
self .changed_files = args .changed_files
56
55
self .issue_number = args .issue_number
57
- self .write_comment_to_file = args .write_comment_to_file
58
56
59
57
60
58
class FormatHelper :
61
59
COMMENT_TAG = "<!--LLVM CODE FORMAT COMMENT: {fmt}-->"
62
60
name : str
63
61
friendly_name : str
64
- comment : dict = None
65
62
66
63
@property
67
64
def comment_tag (self ) -> str :
@@ -122,13 +119,6 @@ def update_pr(self, comment_text: str, args: FormatArgs, create_new: bool) -> No
122
119
comment_text = self .comment_tag + "\n \n " + comment_text
123
120
124
121
existing_comment = self .find_comment (pr )
125
-
126
- if args .write_comment_to_file :
127
- self .comment = {"body" : comment_text }
128
- if existing_comment :
129
- self .comment ["id" ] = existing_comment .id
130
- return
131
-
132
122
if existing_comment :
133
123
existing_comment .edit (comment_text )
134
124
elif create_new :
@@ -319,8 +309,6 @@ def hook_main():
319
309
if fmt .has_tool ():
320
310
if not fmt .run (args .changed_files , args ):
321
311
failed_fmts .append (fmt .name )
322
- if fmt .comment :
323
- comments .append (fmt .comment )
324
312
else :
325
313
print (f"Couldn't find { fmt .name } , can't check " + fmt .friendly_name .lower ())
326
314
@@ -361,11 +349,6 @@ def hook_main():
361
349
type = str ,
362
350
help = "Comma separated list of files that has been changed" ,
363
351
)
364
- parser .add_argument (
365
- "--write-comment-to-file" ,
366
- action = "store_true" ,
367
- help = "Don't post comments on the PR, instead write the comments and metadata a file called 'comment'" ,
368
- )
369
352
370
353
args = FormatArgs (parser .parse_args ())
371
354
@@ -374,18 +357,9 @@ def hook_main():
374
357
changed_files = args .changed_files .split ("," )
375
358
376
359
failed_formatters = []
377
- comments = []
378
360
for fmt in ALL_FORMATTERS :
379
361
if not fmt .run (changed_files , args ):
380
362
failed_formatters .append (fmt .name )
381
- if fmt .comment :
382
- comments .append (fmt .comment )
383
-
384
- if len (comments ):
385
- with open ("comments" , "w" ) as f :
386
- import json
387
-
388
- json .dump (comments , f )
389
363
390
364
if len (failed_formatters ) > 0 :
391
365
print (f"error: some formatters failed: { ' ' .join (failed_formatters )} " )
0 commit comments