Code review that detects and locates defects and other quality issues plays an important role in software quality control. One type of issue that may impact the quality of software is code smells. 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 a study of code smells in code reviews by analyzing 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, and identified 1,539 smell-related reviews. 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 not worth fixing the smell. Our results suggest that: 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.
翻译:为了调查在现代代码审查中查明的代码气味背后的概念,以及行动审查者建议和开发者针对所查明的气味采取什么行动,我们开展了一项代码气味研究,对代码气味进行了分析,分析来自OpenStack(Nova和Neutron)和Qt(Qt Base和Qt Greator)社区的4个大型开放源项目的审评,从而在软件质量控制中发挥重要作用。我们人工检查了总共25 415个代码审查评论,发现在现代代码审查中发现代码气味的程度,并查明了1 539个与气味有关的审查。我们的分析发现:(1) 代码气味不是在代码审查中常见的,2) 通常由于违反编码公约而引发的气味;(3) 审评者通常提供建设性的反馈,包括确定(确认)帮助开发者消除气味的建议;(4) 开发者通常遵循这些建议,并采取行动,5 一旦由审查者确定,通常让开发者在不到一周的时间范围内检查关键地检查由关键搜索和随机挑选的代码,因此,在检测过程中确定一个稳定的气味标准。