TY - JOUR
T1 - Toward the automatic classification of Self-Affirmed Refactoring
AU - AlOmar, Eman Abdullah
AU - Mkaouer, Mohamed Wiem
AU - Ouni, Ali
N1 - Publisher Copyright:
© 2020 Elsevier Inc.
PY - 2021/1
Y1 - 2021/1
N2 - 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.
AB - 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.
KW - Commit classification
KW - Machine learning
KW - Refactoring
KW - Self-affirmed Refactoring
UR - http://www.scopus.com/inward/record.url?scp=85091343972&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85091343972&partnerID=8YFLogxK
U2 - 10.1016/j.jss.2020.110821
DO - 10.1016/j.jss.2020.110821
M3 - Article
AN - SCOPUS:85091343972
SN - 0164-1212
VL - 171
JO - The Journal of Systems and Software
JF - The Journal of Systems and Software
M1 - 110821
ER -