File tree Expand file tree Collapse file tree 2 files changed +15
-16
lines changed Expand file tree Collapse file tree 2 files changed +15
-16
lines changed Original file line number Diff line number Diff line change 88 exit (1 )
99
1010
11- def post_commit ():
11+ def post_commit () -> None :
1212 backup_file = Path (get_backup_file_path ())
1313
1414 # remove backup file if it exists
@@ -17,4 +17,5 @@ def post_commit():
1717
1818
1919if __name__ == "__main__" :
20- exit (post_commit ())
20+ post_commit ()
21+ exit (0 )
Original file line number Diff line number Diff line change 1313 exit (1 )
1414
1515
16- def prepare_commit_msg (commit_msg_file : Path ) -> int :
16+ def prepare_commit_msg (commit_msg_file : str ) -> int :
1717 # check if the commit message needs to be generated using commitizen
18- if (
19- subprocess .run (
20- [
21- "cz" ,
22- "check" ,
23- "--commit-msg-file" ,
24- commit_msg_file ,
25- ],
26- capture_output = True ,
27- ).returncode
28- != 0
29- ):
18+ exit_code = subprocess .run (
19+ [
20+ "cz" ,
21+ "check" ,
22+ "--commit-msg-file" ,
23+ commit_msg_file ,
24+ ],
25+ capture_output = True ,
26+ ).returncode
27+ if exit_code != 0 :
3028 backup_file = Path (get_backup_file_path ())
31-
3229 if backup_file .is_file ():
3330 # confirm if commit message from backup file should be reused
3431 answer = input ("retry with previous message? [y/N]: " )
@@ -54,6 +51,7 @@ def prepare_commit_msg(commit_msg_file: Path) -> int:
5451
5552 # write message to backup file
5653 shutil .copyfile (commit_msg_file , backup_file )
54+ return 0
5755
5856
5957if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments