Abstract
Code review plays an important role in software quality control. A typical review process involves a careful check of a piece of code in an attempt to detect and locate defects and other quality issues/violations. One type of issue that may impact the quality of software is code smells - i.e., bad coding practices that may lead to defects or maintenance issues. Yet, little is known about the extent to which code smells are identified during modern code review. To investigate the concept behind code smells identified in modern code review and what actions reviewers suggest and developers take in response to the identified smells, we conducted an empirical study of code smells in code reviews by analysing reviews from four, large open source projects from the OpenStack (Nova and Neutron) and Qt (Qt Base and Qt Creator) communities. We manually checked a total of 25,415 code review comments obtained by keywords search and random selection; this resulted in the identification of 1,539 smell-related reviews which then allowed the study of the causes of code smells, actions taken against identified smells, time taken to fix identified smells and reasons why developers ignored fixing identified smells. Our analysis found that 1) code smells were not commonly identified in code reviews, 2) smells were usually caused by violation of coding conventions, 3) reviewers usually provided constructive feedback, including fixing (refactoring) recommendations to help developers remove smells, 4) developers generally followed those recommendations and actioned the changes, 5) once identified by reviewers, it usually takes developers less than one week to fix the smells and 6) the main reason why developers chose to ignore the identified smells is that it is not worth fixing the smell. Our results suggest the following: 1) developers should closely follow coding conventions in their projects to avoid introducing code smells, 2) review-based detection of code smells is perceived to be a trustworthy approach by developers, mainly because reviews are context-sensitive (as reviewers are more aware of the context of the code given that they are part of the project’s development team) and 3) program context needs to be fully considered in order to make a decision of whether to fix the identified code smell immediately.
Similar content being viewed by others
Notes
As of March 2022: https://www.openhub.net/p/openstack
Implemented using the NLTK package: https://www.nltk.org
References
Abbes M, Khomh F, Gueheneuc Y G, Antoniol G (2011) An empirical study of the impact of two antipatterns blob and spaghetti code on program comprehension. In: Proceedings of the 15th European conference on software maintenance and reengineering (CSMR). IEEE, pp 181–190
Baker R A Jr (1997) Code reviews enhance software quality. In: Proceedings of the 19th international conference on software engineering (ICSE). ACM, pp 570–571
Bavota G, Qusef A, Oliveto R, De Lucia A, Binkley D (2015) Are test smells really harmful? An empirical study. Empir Softw Eng 20(4):1052–1094
Bosu A, Carver J C, Hafiz M, Hilley P, Janni D (2014) Identifying the characteristics of vulnerable code changes: an empirical study. In: Proceedings of the 22nd ACM SIGSOFT international symposium on foundations of software engineering (FSE). ACM, pp 257–268
Braun V, Clarke V (2006) Using thematic analysis in psychology. Qual Res Psychol 3(2):77–101
Cassee N, Vasilescu B, Serebrenik A (2020) The silent helper: the impact of continuous integration on code reviews. In: Proceedings of the 27th IEEE international conference on software analysis, evolution and reengineering (SANER). IEEE, pp 423–434
Chouchen M, Ouni A, Kula R G, Wang D, Thongtanunam P, Mkaouer M W, Matsumoto K (2021) Anti-patterns in modern code review: symptoms and prevalence. In: Proceedings of the 28th IEEE international conference on software analysis, evolution and reengineering (SANER). IEEE, pp 531–535
Coelho F, Tsantalis N, Massoni T, Alves E L G (2021) An empirical study on refactoring-inducing pull requests. In: Proceedings of the 15th ACM/IEEE international symposium on empirical software engineering and measurement (ESEM). ACM, pp 1–12
Cohen J (1960) A coefficient of agreement for nominal scales. Educ Psychol Meas 20(1):37–46
Dou W, Cheung S C, Wei J (2014) Is spreadsheet ambiguity harmful? Detecting and repairing spreadsheet smells due to ambiguous computation. In: Proceedings of the 36th international conference on software engineering (ICSE). ACM, pp 848–858
Fontana F A, Dietrich J, Walter B, Yamashita A, Zanoni M (2016) Anti-pattern and code smell false positives: preliminary conceptualisation and classification. In: Proceedings of the 23rd international conference on software analysis, evolution, and reengineering (SANER). IEEE, pp 609–613
Fowler M (1999) Refactoring: improving the design of existing code. Addison-Wesley
Garcia J, Popescu D, Edwards G, Medvidovic N (2009) Identifying architectural bad smells. In: Proceedings of the 13th European conference on software maintenance and reengineering (CSMR). IEEE, pp 255–258
Hall T, Zhang M, Bowes D, Sun Y (2014) Some code smells have a significant but small effect on faults. ACM Trans Softw Eng Methodol 23 (4):1–39
Han X, Tahir A, Liang P, Counsell S, Luo Y (2021) Understanding code smell detection via code review: a study of the openstack community. In: Proceedings of the 29th IEEE/ACM international conference on program comprehension (ICPC). IEEE, pp 323–334
Han X, Tahir A, Liang P, Counsell S, Blincoe K, Li B, Luo Y (2022) Replication package for the paper: code smells detection via modern code review: a study of the OpenStack and Qt communities. https://doi.org/10.5281/zenodo.5588454
Hirao T, McIntosh S, Ihara A, Matsumoto K (2020) Code reviews with divergent review scores: an empirical study of the openstack and qt communities. IEEE Trans Softw Eng. https://doi.org/10.1109/TSE.2020.2977907https://doi.org/10.1109/TSE.2020.2977907
Israel G D (1992) Determining sample size. Fact Sheet PEOD-6, Florida Cooperative Extension Service, Institute of Food and Agricultural Sciences, University of Florida, Florida
Kaplan E L, Meier P (1958) Nonparametric estimation from incomplete observations. J Am Stat Assoc 53(282):457–481
Kemerer C F, Paulk M C (2009) The impact of design and code reviews on software quality: an empirical study based on psp data. IEEE Trans Softw Eng 35(4):534–550
Khomh F, Di Penta M, Gueheneuc Y G (2009) An exploratory study of the impact of code smells on software change-proneness. In: Proceedings of the 16th working conference on reverse engineering (WCRE). IEEE, pp 75–84
Kononenko O, Baysal O, Guerrouj L, Cao Y, Godfrey M W (2015) Investigating code review quality: do people and participation matter?. In: Proceedings of the 31th IEEE international conference on software maintenance and evolution (ICSME). IEEE, pp 111–120
Kruskal W H, Wallis W A (1952) Use of ranks in one-criterion variance analysis. J Am Stat Assoc 47(260):583–621
Li Z, Avgeriou P, Liang P (2015) A systematic mapping study on technical debt and its management. J Syst Softw 101:193–220
Mann H B, Whitney D R (1947) On a test of whether one of two random variables is stochastically larger than the other. Ann Math Stat 50–60
Martini A, Fontana F A, Biaggi A, Roveda R (2018) Identifying and prioritizing architectural debt through architectural smells: a case study in a large software company. In: Proceedings of the 12th European conference on software architecture (ECSA). Springer, pp 320–335
McConnell S (2004) Code complete. Pearson Education
McIntosh S, Kamei Y, Adams B, Hassan A E (2014) The impact of code review coverage and code review participation on software quality: a case study of the Qt, VTK, and ITK projects. In: Proceedings of the 11th working conference on mining software repositories (MSR). ACM, pp 192–201
McIntosh S, Kamei Y, Adams B, Hassan A E (2016) An empirical study of the impact of modern code review practices on software quality. Empir Softw Eng 21(5):2146–2189
Meneely A, Tejeda A C R, Spates B, Trudeau S, Neuberger D, Whitlock K, Ketant C, Davis K (2014) An empirical investigation of socio-technical code review metrics and security vulnerabilities. In: Proceedings of the 6th international workshop on social software engineering (SSE). ACM, pp 37–44
Moha N, Gueheneuc Y G, Duchien L, Le Meur A F (2009) Decor: a method for the specification and detection of code and design smells. IEEE Trans Softw Eng 36(1):20–36
Morales R, McIntosh S, Khomh F (2015) Do code review practices impact design quality? A case study of the Qt, VTK, and ITK projects. In: Proceedings of the 22nd IEEE international conference on software analysis, evolution, and reengineering (SANER). IEEE, pp 171–180
Nanthaamornphong A, Chaisutanon A (2016) Empirical evaluation of code smells in open source projects: preliminary results. In: Proceedings of the 1st international workshop on software refactoring (IWoR). ACM, pp 5–8
Palomba F, Bavota G, Di Penta M, Oliveto R, De Lucia A (2014) Do they really smell bad? A study on developers’ perception of bad code smells. In: Proceedings of the 30th international conference on software maintenance and evolution (ICSME). IEEE, pp 101–110
Palomba F, Bavota G, Di Penta M, Oliveto R, Poshyvanyk D, De Lucia A (2015) Mining version histories for detecting code smells. IEEE Trans Softw Eng 41(5):462–489
Palomba F, Bavota G, Di Penta M, Fasano F, Oliveto R, De Lucia A (2018) On the diffuseness and the impact on maintainability of code smells: a large scale empirical investigation. Empir Softw Eng 23(3):1188–1221
Panichella S, Zaugg N (2020) An empirical investigation of relevant changes and automation needs in modern code review. Empir Softw Eng 25(6):4833–4872
Pascarella L, Spadini D, Palomba F, Bacchelli A (2020) On the effect of code review on code smells. In: Proceedings of the 27th IEEE international conference on software analysis, evolution and reengineering (SANER). IEEE
Pecorelli F, Palomba F, Khomh F, De Lucia A (2020) Developer-driven code smell prioritization. In: Proceedings of the 17th working conference on mining software repositories (MSR). ACM, pp 220–231
Porter MF (2001) Snowball: a language for stemming algorithms. Open Source Initiative OSI
Potdar A, Shihab E (2014) An exploratory study on self-admitted technical debt. In: Proceedings of the 30th IEEE international conference on software maintenance and evolution (ICSME). IEEE, pp 91–100
Sae-Lim N, Hayashi S, Saeki M (2018) Context-based approach to prioritize code smells for prefactoring. J Softw: Evol Process 30(6):1–24
Sharma T, Spinellis D (2018) A survey on software smells. J Syst Softw 138:158–173
Sjøberg DI, Yamashita A, Anda B C, Mockus A, Dybå T (2013) Quantifying the effect of code smells on maintenance effort. IEEE Trans Softw Eng 39(8):1144–1156
Soh Z, Yamashita A, Khomh F, Guéhéneuc Y G (2016) Do code smells impact the effort of different maintenance programming activities?. In: Proceedings of the 23rd international conference on software analysis, evolution, and reengineering (SANER). IEEE, pp 393–402
Tahir A, Counsell S, MacDonell S G (2016) An empirical study into the relationship between class features and test smells. In: Proceedings of the 23rd Asia-Pacific software engineering conference (APSEC). IEEE, pp 137–144
Tahir A, Yamashita A, Licorish S, Dietrich J, Counsell S (2018) Can you tell me if it smells? A study on how developers discuss code smells and anti-patterns in stack overflow. In: Proceedings of the 22nd international conference on evaluation and assessment in software engineering (EASE). ACM, pp 68–78
Tahir A, Dietrich J, Counsell S, Licorish S, Yamashita A (2020) A large scale study on how developers discuss code smells and anti-pattern in stack exchange sites. Inf Softw Technol 125:106333
Taibi D, Janes A, Lenarduzzi V (2017) How developers perceive smells in source code: a replicated study. Inf Softw Technol 92:223–235
Tan P N, Steinbach M, Kumar V (2016) Introduction to data mining. Pearson Education India
Tsantalis N, Chatzigeorgiou A (2009) Identification of move method refactoring opportunities. IEEE Trans Softw Eng 35(3):347–367
Tufano M, Palomba F, Bavota G, Oliveto R, Di Penta M, De Lucia A, Poshyvanyk D (2015) When and why your code starts to smell bad. In: Proceedings of the IEEE/ACM 37th IEEE international conference on software engineering (ICSE), vol 1. IEEE, pp 403–414
Uchôa A, Barbosa C, Coutinho D, Oizumi W, Assunção W K G, Vergilio S R, Pereira J A, Oliveira A, Garcia A (2021) Predicting design impactful changes in modern code review: a large-scale empirical study. In: Proceedings of the 18th IEEE/ACM international conference on mining software repositories (MSR). IEEE, pp 471–482
Wessel M, Serebrenik A, Wiese I, Steinmacher I, Gerosa M A (2020) Effects of adopting code review bots on pull requests to oss projects. In: Proceedings of the 36th IEEE international conference on software maintenance and evolution (ICSME). IEEE, pp 1–11
Wohlin C, Runeson P, Höst M, Ohlsson M C, Regnell B, Wesslén A (2012) Experimentation in software engineering. Springer, Berlin
Yamashita A, Moonen L (2013) Do developers care about code smells? An exploratory survey. In: Proceedings of the 20th working conference on reverse engineering (WCRE). IEEE, pp 242–251
Zanaty F E, Hirao T, McIntosh S, Ihara A, Matsumoto K (2018) An empirical study of design discussions in code review. In: Proceedings of the 12th ACM/IEEE international symposium on empirical software engineering and measurement (ESEM). ACM, pp 1–10
Zhang M, Hall T, Baddoo N (2011) Code bad smells: a review of current knowledge. J Softw Maint Evol: Res Pract 23(3):179–202
Acknowledgements
This work is supported by the National Natural Science Foundation of China (NSFC) under Grant No. 62172311 and the Special Fund of Hubei Luojia Laboratory.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of Interest
The authors declare that they have no conflict of interest.
Additional information
Communicated by: Anita Sarma, Fabio Palomba, Alexander Serebrenik
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
This article belongs to the Topical Collection: International Conference on Program Comprehension (ICPC)
Rights and permissions
About this article
Cite this article
Han, X., Tahir, A., Liang, P. et al. Code smells detection via modern code review: a study of the OpenStack and Qt communities. Empir Software Eng 27, 127 (2022). https://doi.org/10.1007/s10664-022-10178-7
Accepted:
Published:
DOI: https://doi.org/10.1007/s10664-022-10178-7