File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -80,18 +80,16 @@ def _get_message_by_prompt_commit_questions(self) -> str:
8080 raise NoAnswersError ()
8181
8282 message = self .cz .message (answers )
83- self ._validate_subject_length (message )
83+ if limit := self .arguments .get ("message_length_limit" , 0 ):
84+ self ._validate_subject_length (message = message , length_limit = limit )
8485 return message
8586
86- def _validate_subject_length (self , message : str ) -> None :
87+ def _validate_subject_length (self , * , message : str , length_limit : int ) -> None :
8788 # By the contract, message_length_limit is set to 0 for no limit
8889 subject = message .partition ("\n " )[0 ].strip ()
89- limit = self .arguments .get ("message_length_limit" , 0 )
90- if limit == 0 :
91- return
92- if len (subject ) > limit :
90+ if len (subject ) > length_limit :
9391 raise CommitMessageLengthExceededError (
94- f"Length of commit message exceeds limit ({ len (subject )} /{ limit } ), subject: '{ subject } '"
92+ f"Length of commit message exceeds limit ({ len (subject )} /{ length_limit } ), subject: '{ subject } '"
9593 )
9694
9795 def manual_edit (self , message : str ) -> str :
You can’t perform that action at this time.
0 commit comments