Code smells in pull requests: An exploratory study
The quality of a pull request is the primary factor integrators consider for its acceptance or rejection. Code smells indicate sub‐optimal design or implementation choices in the source code that often lead to a fault‐prone outcome, threatening the quality of pull requests. This study explores code...
Saved in:
Published in | Software, practice & experience Vol. 54; no. 3; pp. 419 - 436 |
---|---|
Main Authors | , , , |
Format | Journal Article |
Language | English |
Published |
Bognor Regis
Wiley Subscription Services, Inc
01.03.2024
|
Subjects | |
Online Access | Get full text |
Cover
Loading…
Summary: | The quality of a pull request is the primary factor integrators consider for its acceptance or rejection. Code smells indicate sub‐optimal design or implementation choices in the source code that often lead to a fault‐prone outcome, threatening the quality of pull requests. This study explores code smells in 21k pull requests from 25 popular Java projects. We find that both accepted (37%) and rejected (44%) pull requests have code smells, affected mainly by god classes and long methods. Besides, we observe that smelly pull requests are more complex and challenging to understand as they have significantly large sizes, long latency times, more discussion and review comments, and are submitted by contributors with less experience. Our results show that features used in previous studies for pull request acceptance prediction could be potentially employed to predict smell in incoming pull requests. We propose a dynamic approach to predict the presence of such code smells in the newly added pull requests. We evaluate our approach on a dataset of 25 Java projects extracted from GitHub. We further conduct a benchmark study to compare the performance of eight machine learning classifiers. Results of the benchmark study show that XGBoost is the best‐performing classifier for smell prediction. |
---|---|
ISSN: | 0038-0644 1097-024X |
DOI: | 10.1002/spe.3283 |