File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -41,22 +41,23 @@ def main() -> int:
4141 with path .open ("r+" ) as file :
4242 data = file .read ()
4343 transformed_content = transform_file_content (data )
44- if data != transformed_content :
45- has_changes = True
44+ if data == transformed_content :
45+ continue
46+
47+ has_changes = True
4648
4749 if args .check :
48- if data != transformed_content :
49- sys .stdout .writelines (
50- unified_diff (
51- data .splitlines (keepends = True ),
52- transformed_content .splitlines (keepends = True ),
53- fromfile = str (path ),
54- tofile = str (path ),
55- )
50+ sys .stdout .writelines (
51+ unified_diff (
52+ data .splitlines (keepends = True ),
53+ transformed_content .splitlines (keepends = True ),
54+ fromfile = str (path ),
55+ tofile = str (path ),
5656 )
57+ )
5758 else :
5859 file .seek (0 )
5960 file .write (transformed_content )
6061 file .truncate ()
6162
62- return has_changes
63+ return has_changes if args . check else 0
You can’t perform that action at this time.
0 commit comments