Abstract
In the pull-based development model, code review is essential for quality control, yet the resulting volume of comments can be overwhelming for developers and researchers. This paper presents a Two-Stage Hybrid Classification (TSHC) approach to automatically categorize these comments. By integrating pattern-matching rules, machine learning, and metadata features such as author roles, the TSHC algorithm achieves significant performance gains over traditional text-based methods. Evaluation across three major open-source projects—Rails, Elasticsearch, and Angular.js—demonstrates weighted average F-measure improvements of up to 9.2%.
Introduction
The "pull-based" development model, popularized by platforms like GitHub, relies heavily on code reviews to maintain software quality. However, as projects scale, the sheer volume of discussion within Pull Requests (PRs) becomes a bottleneck. Understanding the nature of these discussions—whether they concern technical bugs, project roadmaps, or social interactions—is crucial for both integrators and researchers. Existing tools often struggle with the short, jargon-heavy, and code-interspersed nature of review comments.
Methods
The proposed Two-Stage Hybrid Classification (TSHC) algorithm addresses these challenges by combining textual analysis with contextual metadata.
In Stage One, the system performs textual analysis. It begins with preprocessing, replacing source code, hyperlinks, and quotes with generic placeholders (e.g., cmmcode, cmmlink) to reduce noise. It then applies "Inspection Rules" (regular expressions) to identify common phrases like "LGTM" (Looks Good To Me). Finally, a Support Vector Machine (SVM) uses TF-IDF to generate a "Vector of Possibility" (VP) for various categories.
Stage Two integrates this VP with metadata features, including the comment type (inline vs. general), the author's role (Core Team vs. External), and the contextual similarity between the comment and the PR's description. A final prediction model uses this combined feature set to assign category labels.
Datasets and Taxonomy
The researchers evaluated their approach using a manually labeled dataset of over 5,600 comments from 1,800 PRs in three projects: Rails (Ruby), Elasticsearch (Java), and Angular.js (JavaScript). They employed a two-level taxonomy consisting of four top-level categories—Correctness, Decision, Management, and Interaction—and 11 fine-grained sub-categories (e.g., Style, Roadmap, Encouragement).
Key Results
The TSHC approach consistently outperformed standard text-based classifiers (TBC) across all evaluated projects.
As shown in the results table, TSHC achieved a 9.2% improvement in weighted average F-measure for Rails (reaching 0.78), a 5.3% improvement for Elasticsearch (reaching 0.82), and a 7.2% improvement for Angular.js (reaching 0.75). The system was particularly adept at identifying "Response" and "Convention" comments. However, it faced challenges with "Questioning" and "Disagreeing" categories, which often lack explicit keywords and require deeper semantic understanding.
Conclusion
This research highlights that metadata is a powerful signal in classifying short, technical communications. By combining human-defined rules with machine learning and contextual data, the TSHC algorithm provides a robust framework for automated content analysis in code reviews. Future work will explore the integration of sentiment analysis and the application of these classifications to reviewer recommendation and PR prioritization systems.
Summary updated