Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Kafka Standardize Jira Ref

From Leeroopedia


Knowledge Sources
Domains Development_Workflow, Code_Quality
Last Updated 2026-02-09 12:00 GMT

Overview

Concrete tool for normalizing JIRA references in commit messages provided by the kafka-merge-pr script.

Description

The standardize_jira_ref function uses regex patterns to parse a PR title, extract JIRA issue identifiers, normalize their format, and reconstruct a standardized commit message. It handles edge cases like missing issue numbers, multiple JIRA references, and various delimiter styles.

Usage

Called automatically during the merge process to standardize the commit title before creating the squash merge commit.

Code Reference

Source Location

  • Repository: Apache Kafka
  • File: committer-tools/kafka-merge-pr.py
  • Lines: L328-384

Signature

def standardize_jira_ref(text):
    """
    Standardizes commit message prefix to 'KAFKA-XXX; Description'.
    Extracts JIRA references, component tags, and message text.
    Returns standardized string.
    """

Import

# Internal function in kafka-merge-pr.py
import re

I/O Contract

Inputs

Name Type Required Description
text str Yes PR title or commit message to standardize

Outputs

Name Type Description
return str Standardized string in format "KAFKA-XXXXX; Description"

Usage Examples

# Various input formats all normalize to standard format
standardize_jira_ref("KAFKA-12345 Fix consumer offset commit")
# Returns: "KAFKA-12345; Fix consumer offset commit"

standardize_jira_ref("[KAFKA-12345] Fix consumer offset commit")
# Returns: "KAFKA-12345; Fix consumer offset commit"

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment