@@ -31,22 +31,22 @@ def __scopeCheck(msg: str):
31
31
status = "Message scope: "
32
32
33
33
if not re .match ('^[a-z0-9]+(, [a-z0-9]+)*: ' , msg ):
34
- print (f"{ status } FAILED: Commit message must follow the format <scope>:[ <scope>:] <short description>" )
34
+ print (f"{ status } FAILED: Commit message must follow the format "
35
+ "<scope>:[ <scope>:] <short description>" )
35
36
return False
36
37
37
38
print (f"{ status } OK" )
38
39
return True
39
40
40
- # Ensuring a character limit for the first line.
41
+ # Ensure a character limit for the first line.
41
42
def __numCharacterCheck (msg : str ):
42
43
status = "Message length:"
43
- summary = msg .partition ("\n " )[0 ]
44
- msgSummaryLen = len (summary )
45
- if msgSummaryLen <= 72 :
44
+ if len (msg ) <= 72 :
46
45
print (f"{ status } OK" )
47
46
return True
48
47
else :
49
- print (f"{ status } FAILED: Commit message summary must not exceed 72 characters." )
48
+ print (f"{ status } FAILED: Commit message summary must not "
49
+ "exceed 72 characters." )
50
50
return False
51
51
52
52
def main ():
@@ -58,7 +58,8 @@ def main():
58
58
head : str = args .head
59
59
60
60
commit_range = base + ".." + head
61
- messages = subprocess .run (["git" , "rev-list" , "--format=oneline" , commit_range ], capture_output = True , text = True ).stdout
61
+ messages = subprocess .run (["git" , "rev-list" , "--format=oneline" ,
62
+ commit_range ], capture_output = True , text = True ).stdout
62
63
63
64
is_ok = True
64
65
for i in messages .splitlines ():
@@ -72,7 +73,8 @@ def main():
72
73
if is_ok :
73
74
print ("All commmit messages are formatted correctly. " )
74
75
else :
75
- print ("Some commit message checks failed. Please align commit messages with Contributing Guidelines and update the PR." )
76
+ print ("Some commit message checks failed. Please align commit messages "
77
+ "with Contributing Guidelines and update the PR." )
76
78
exit (1 )
77
79
78
80
0 commit comments