@@ -36,6 +36,10 @@ def __init__(self, target_repo, series):
36
36
"shortlog_format" ,
37
37
self ._results (test_mbox_shortlog_format ),
38
38
),
39
+ (
40
+ "shortlog_length" ,
41
+ self ._results (test_mbox_shortlog_length ),
42
+ ),
39
43
(
40
44
"has_commit_message" ,
41
45
self ._results (test_mbox_has_commit_message ),
@@ -111,6 +115,24 @@ def test_mbox_shortlog_format(target):
111
115
return PatchtestResult (target .subject , test_name , result , reason )
112
116
113
117
118
+ def test_mbox_shortlog_length (target ):
119
+ shortlog = re .sub ("^(\[.*?\])+ " , "" , target .shortlog )
120
+ shortlog_len = len (shortlog )
121
+ test_name = "test_mbox_shortlog_length"
122
+ result = "PASS"
123
+ reason = f"Edit shortlog so that it is { patterns .mbox_shortlog_maxlength } characters or less (currently { shortlog_len } characters)"
124
+
125
+ print (target .shortlog )
126
+ if shortlog .startswith ('Revert "' ):
127
+ result = "SKIP"
128
+ reason = "No need to test revert patches"
129
+ else :
130
+ if shortlog_len > patterns .mbox_shortlog_maxlength :
131
+ result = "FAIL"
132
+
133
+ return PatchtestResult (target .subject , test_name , result , reason )
134
+
135
+
114
136
def test_mbox_has_commit_message (target ):
115
137
test_name = "test_mbox_has_commit_message"
116
138
result = "PASS"
@@ -129,10 +151,11 @@ def test_mbox_has_commit_message(target):
129
151
130
152
return PatchtestResult (target .subject , test_name , result , reason )
131
153
154
+
132
155
def test_mbox_unidiff_parse_error (target ):
133
156
test_name = "test_mbox_unidiff_parse_error"
134
157
result = "PASS"
135
- reason = f" Patch \ "{ target .shortlog } \ " contains malformed diff lines."
158
+ reason = f' Patch "{ target .shortlog } " contains malformed diff lines.'
136
159
137
160
try :
138
161
diff = unidiff .PatchSet .from_string (target .data .as_string ())
0 commit comments