This is an automated email from the ASF dual-hosted git repository.

apoorvmittal10 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 93657c06511 MINOR: Correcting reviewers script for names (#22449)
93657c06511 is described below

commit 93657c0651110064e0ca2a97b4250878650735da
Author: Apoorv Mittal <[email protected]>
AuthorDate: Wed Jun 3 12:28:01 2026 +0100

    MINOR: Correcting reviewers script for names (#22449)
    
    The reviewers.py script incorrectly parses reviewer names that start
    with characters appearing in "Author:" or "Reviewers:", leading to
    truncated names.
    
    ### Issue
    
    stripped = line.strip().lstrip("Reviewers: ").lstrip("Author: ")
    
    The Problem: lstrip(string) does not remove a prefix string. Instead, it
    removes any characters from that character set from the left side of the
    string.
    
    ### Fix
    
    Replace the buggy lstrip() calls with proper prefix removal. Two options
    available:
    
    Option 1: Using removeprefix() (Python 3.9+)
    ```
    stripped = line.strip().removeprefix("Reviewers:
    ").removeprefix("Author: ")
    ```
    Requires Python 3.9+
    
    Option 2: Using startswith() (Python 3.0+)
    
    Used option 2 as the script currently supports Python 3+
    
    Example Issue:
    When searching for "Apoorv", the script showed:
    - poorv Mittal [email protected] ❌ - Missing the "A"
    - Apoorv Mittal [email protected] ✅ - Correct
    
    Reviewers: Chia-Ping Tsai <[email protected]>, Ming-Yen Chung
     <[email protected]>
---
 committer-tools/reviewers.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/committer-tools/reviewers.py b/committer-tools/reviewers.py
index 92a1564848b..d44994fcd9d 100755
--- a/committer-tools/reviewers.py
+++ b/committer-tools/reviewers.py
@@ -84,7 +84,11 @@ if __name__ == "__main__":
     lines = stream.readlines()
     all_reviewers = defaultdict(int)
     for line in lines:
-        stripped = line.strip().lstrip("Reviewers: ").lstrip("Author: ")
+        stripped = line.strip()
+        if stripped.startswith("Reviewers: "):
+            stripped = stripped[len("Reviewers: "):]
+        elif stripped.startswith("Author: "):
+            stripped = stripped[len("Author: "):]
         reviewers = stripped.split(",")
         for reviewer in reviewers:
             all_reviewers[reviewer.strip()] += 1

Reply via email to