NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Full-fledged Commit Message Quality Checker Based on Machine Learning

David Faragó, Michael Färber, Christian Petrov · DOI

Introduction

Commit messages are a vital part of software maintenance, yet they are frequently neglected. As Linus Torvalds famously remarked, "GitHub is a total ghetto of crap commit messages." Vague descriptions like "fix," "update," or "..." provide no context for future developers, making it difficult to understand the intent behind code changes. While existing linters can catch basic formatting errors, they lack the natural language understanding (NLU) required to judge if a message is actually informative.

Researchers have now developed the first "full-fledged" commit message checker that bridges this gap. By leveraging machine learning, specifically fine-tuned CodeBERT models, this tool evaluates not just the syntax of a message, but its semantic depth—determining whether a developer has explained why a change was made, rather than just how.

Defining Quality: The 7 Rules

The framework is built around the industry-standard "Chris Beams’ 7 rules" for great commit messages. These rules range from simple formatting (e.g., length and capitalization) to complex semantic requirements.

The seven industry-standard rules for commit messages and examples of common semantic violations.

The most challenging rules to automate are Rule 5 (using the imperative mood) and Rule 7 (explaining the 'what' and 'why' versus the 'how'). Rule 7 is particularly nuanced; a message might be syntactically correct but semantically empty, failing to provide the context necessary for long-term project health.

The Five-Stage Prediction Pipeline

To address these diverse requirements, the authors implemented a five-stage classification pipeline. This architecture combines traditional rule-based logic with state-of-the-art transformer models.

The five-stage prediction pipeline combining rule-based checks with CodeBERT-driven semantic analysis.
  1. Task 1 (Rule-based): Checks formatting, such as subject line length and the presence of a blank line after the subject.
  2. Task 2 (CodeBERT): Analyzes the subject line to ensure it uses the imperative mood (e.g., "Fix bug" instead of "Fixed bug").
  3. Task 3 & 4 (CodeBERT): Filters out "trivial" commits, such as documentation-only changes or version bumps. These commits often follow different project conventions and require less rigorous descriptions.
  4. Task 5 (CodeBERT): The core semantic task. It evaluates whether the body of the message successfully explains the rationale behind the change.

To ensure the tool is practical for daily use, the models were exported to the ONNX format. This optimization reduced inference time from several seconds to a mere 0.02 seconds on a standard CPU, making it fast enough to function as a pre-commit git hook or an IDE plugin.

Dataset and Expert Labeling

Because no "gold standard" dataset existed for these specific rules, the researchers curated a new dataset from 1,700 popular GitHub repositories across 17 programming languages. Five industry experts with over eight years of experience were recruited to label the data.

For the semantic evaluation (Task 5), the team moved beyond binary "good/bad" labels to a 4-point scale. This approach was designed to minimize "central tendency bias" and capture the subtle nuances of developer communication. The final dataset for this core task included 808 meticulously labeled commit messages.

Key Insights and Results

The framework achieved a new state-of-the-art performance in commit message evaluation. It reached a 97.8% F1 score for detecting the imperative mood and an 82.9% F1 score for semantic quality (Task 5). This represents a significant improvement over previous research, which struggled to exceed 61.5% on similar semantic tasks.

Beyond raw metrics, the study revealed several cultural insights:

  • Systems vs. High-level Languages: Projects in systems languages like C, C++, and Go consistently featured higher-quality messages than those in C# or CoffeeScript. This suggests that the complexity of low-level environments may necessitate more rigorous documentation.
  • Corporate Culture: Commits from major tech organizations (e.g., Uber, Apple, Twitter) scored significantly higher than the average, indicating that message quality is often a top-down cultural trait.
  • Bimodal Input: The model’s accuracy in identifying documentation changes improved when it was given both the commit text and the count of changed file extensions (e.g., identifying multiple .md files).

Conclusion and Future Work

While the tool is highly effective, it currently faces a 512-token limit inherent to BERT-based models. Furthermore, the model primarily analyzes the message text rather than the code itself. Future iterations aim to incorporate "code diffs," allowing the model to verify if the commit message accurately reflects the logic changes in the source code. By automating the enforcement of high-quality documentation, this tool offers a path toward more maintainable and transparent software development.

Summary updated

BibTeX
@inproceedings{farago2023full,
  author = {David Faragó and Michael Färber and Christian Petrov},
  title = {{A Full-fledged Commit Message Quality Checker Based on Machine Learning}},
  booktitle = {COMPSAC},
  year = {2023},
  url = {https://openreview.net/forum?id=RWJuHEBsZP},
}
Figure