论文标题
自动对自我确认的重构分类
Toward the Automatic Classification of Self-Affirmed Refactoring
论文作者
论文摘要
引入了自我确认的重构(SAR)的概念,以探讨开发人员如何记录其在提交消息中的重构活动,即开发人员在代码更改期间故意引入的重构操作的明确文档。在我们先前的研究中,我们仅考虑仅考虑与重构相关的提交,已经手动确定了重构模式,并定义了三个主要的共同质量改进类别,包括内部质量属性,外部质量属性和代码气味。但是,这种方法在很大程度上取决于对提交消息的手动检查。在本文中,我们提出了一种两步方法,首先确定提交是否描述了与开发人员相关的重构事件,然后根据重构共同的质量改进类别对其进行分类。具体而言,我们将N-Gram TF-IDF功能选择与二进制和多类分类器相结合,以建立一个新模型,以根据其质量改进类别自动化重构的分类。我们使用从经过精心设计的开源Java项目中提取的总共2,867个提交消息来挑战我们的模型。我们的发现表明,(1)我们的模型能够准确地对SAR提交,表现优于基于模式的和随机的分类器方法,并允许发现40个相关的SAR模式,并且(2)我们的模型即使使用相对较小的训练数据集也达到了90%的F量。
The concept of Self-Affirmed Refactoring (SAR) was introduced to explore how developers document their refactoring activities in commit messages, i.e., developers' explicit documentation of refactoring operations intentionally introduced during a code change. In our previous study, we have manually identified refactoring patterns and defined three main common quality improvement categories, including internal quality attributes, external quality attributes, and code smells, by only considering refactoring-related commits. However, this approach heavily depends on the manual inspection of commit messages. In this paper, we propose a two-step approach to first identify whether a commit describes developer-related refactoring events, then to classify it according to the refactoring common quality improvement categories. Specifically, we combine the N-Gram TF-IDF feature selection with binary and multiclass classifiers to build a new model to automate the classification of refactorings based on their quality improvement categories. We challenge our model using a total of 2,867 commit messages extracted from well-engineered open-source Java projects. Our findings show that (1) our model is able to accurately classify SAR commits, outperforming the pattern-based and random classifier approaches, and allowing the discovery of 40 more relevant SAR patterns, and (2) our model reaches an F-measure of up to 90% even with a relatively small training dataset.