File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 11import argparse
22import sys
33from collections .abc import Iterable
4- from difflib import ndiff
4+ from difflib import unified_diff
55from pathlib import Path
66
77from auto_typing_final .transform import transform_file_content
@@ -45,10 +45,15 @@ def main() -> int:
4545 has_changes = True
4646
4747 if args .check :
48- sys .stdout .writelines ([f"{ path } \n " ])
49- sys .stdout .writelines (
50- ndiff (data .splitlines (keepends = True ), transformed_content .splitlines (keepends = True ))
51- )
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+ )
56+ )
5257 else :
5358 file .seek (0 )
5459 file .write (transformed_content )
You can’t perform that action at this time.
0 commit comments