File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -39,23 +39,22 @@ def run(cmd, **args):
3939
4040
4141def process_changed_file (filename ):
42- if os .path .splitext (filename )[1 ] != '.json' :
43- return f'{ filename } updated\n '
4442 content = open (filename ).read ()
4543 old_content = run (['git' , 'show' , f'HEAD:{ filename } ' ])
4644 print (f'processing { filename } ' )
47- if len (content .splitlines ()) == 1 :
45+
46+ ext = os .path .splitext (filename )[1 ]
47+ if ext == '.size' :
4848 size = int (content .strip ())
4949 old_size = int (old_content .strip ())
50- else :
51- try :
52- current_json = json .loads (content )
53- old_json = json .loads (old_content )
54- except Exception :
55- print (f'{ filename } : Unable to parse json content' )
56- sys .exit (1 )
50+ elif ext == '.json' :
51+ current_json = json .loads (content )
52+ old_json = json .loads (old_content )
5753 size = current_json ['total' ]
5854 old_size = old_json ['total' ]
55+ else :
56+ # Unhandled file type
57+ return f'{ filename } updated\n '
5958
6059 filename = utils .removeprefix (filename , 'test/' )
6160 delta = size - old_size
You can’t perform that action at this time.
0 commit comments