brandboat commented on code in PR #19159:
URL: https://github.com/apache/kafka/pull/19159#discussion_r1987551464


##########
.github/scripts/pr-format.py:
##########
@@ -105,50 +112,55 @@ def parse_trailers(title, body) -> Dict:
     body = gh_json["body"]
     reviews = gh_json["reviews"]
 
-    warnings = []
-    errors = []
-
-    # Check title
-    if title.endswith("..."):
-        errors.append("Title appears truncated")
-
-    if len(title) < 15:
-        errors.append("Title is too short")
+    checks = [] # (bool (0=ok, 1=error), message)
 
-    if len(title) > 120:
-        errors.append("Title is too long")
+    def check(positive_assertion, ok_msg, err_msg):
+        if positive_assertion:
+            checks.append((0, f"{ok} {ok_msg}"))
+        else:
+            checks.append((1, f"{err} {err_msg}"))
 
-    if not title.startswith("KAFKA-") and not title.startswith("MINOR") and 
not title.startswith("HOTFIX"):
-        errors.append("Title is missing KAFKA-XXXXX or MINOR/HOTFIX prefix")
+    # Check title
+    check(not title.endswith("..."), "Title is not truncated", "Title appears 
truncated")
+    check(len(title) >= 15, "Title is not too short", "Title is too short")
+    check(len(title) < 120, "Title is not too long", "Title is too long")

Review Comment:
   Sorry for jump into the discussion, I'm wondering is this a strict 
requirement? Our PR titles are come from the JIRA titles, and sometimes the 
JIRA titles are too long, causing them to exceed the length limit here. If we 
need to shorten the PR title, does that mean we also have to modify the JIRA 
title accordingly?



##########
.github/scripts/pr-format.py:
##########
@@ -105,50 +112,55 @@ def parse_trailers(title, body) -> Dict:
     body = gh_json["body"]
     reviews = gh_json["reviews"]
 
-    warnings = []
-    errors = []
-
-    # Check title
-    if title.endswith("..."):
-        errors.append("Title appears truncated")
-
-    if len(title) < 15:
-        errors.append("Title is too short")
+    checks = [] # (bool (0=ok, 1=error), message)
 
-    if len(title) > 120:
-        errors.append("Title is too long")
+    def check(positive_assertion, ok_msg, err_msg):
+        if positive_assertion:
+            checks.append((0, f"{ok} {ok_msg}"))
+        else:
+            checks.append((1, f"{err} {err_msg}"))
 
-    if not title.startswith("KAFKA-") and not title.startswith("MINOR") and 
not title.startswith("HOTFIX"):
-        errors.append("Title is missing KAFKA-XXXXX or MINOR/HOTFIX prefix")
+    # Check title
+    check(not title.endswith("..."), "Title is not truncated", "Title appears 
truncated")
+    check(len(title) >= 15, "Title is not too short", "Title is too short")
+    check(len(title) < 120, "Title is not too long", "Title is too long")

Review Comment:
   Sorry for jumping into the discussion, I'm wondering is this a strict 
requirement? Our PR titles are come from the JIRA titles, and sometimes the 
JIRA titles are too long, causing them to exceed the length limit here. If we 
need to shorten the PR title, does that mean we also have to modify the JIRA 
title accordingly?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to