Code review plays an important role in software quality control. A typical review process would involve a careful check of a piece of code in an attempt to find defects and other quality issues/violations. One type of issues that may impact the quality of the software is code smells - i.e., bad programming practices that may lead to defects or maintenance issues. Yet, little is known about the extent to which code smells are identified during code reviews. To investigate the concept behind code smells identified in code reviews 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 using the two most active OpenStack projects (Nova and Neutron). We manually checked 19,146 review comments obtained by keywords search and random selection, and got 1,190 smell-related reviews to study the causes of code smells and actions taken against the 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, and 4) developers generally followed those recommendations and actioned the changes. Our results suggest that 1) developers should closely follow coding conventions in their projects to avoid introducing code smells, and 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).
翻译:守则审查在软件质量控制中起着重要作用。典型的审查过程将涉及仔细检查守则的一部分,以查找缺陷和其他质量问题/违规情况。一种可能影响到软件质量的问题是代码气味----即可能导致缺陷或维护问题的不良编程做法;然而,对于守则在代码审查中发现编码气味的程度知之甚少。为了调查守则审查中查明的守则气味背后的概念,以及审查者建议和开发者针对已查明的气味采取什么行动,我们利用两个最活跃的OpenStack项目(Nova和Neutron)对守则审查中的守则气味进行了实证性研究。我们人工核对了19,146项通过关键词搜索和随机选择获得的评论,并收到了1,190项与气味有关的审查,以研究守则的气味和针对已查明的气味采取的行动。我们的分析发现,1项守则的气味通常由违反编码的公约导致,3项审查者通常提供建设性的反馈,包括确定(重新校正)建议,4项是,开发者一般遵循的是关键词搜索和检验方法,因此,我们建议采用比较可靠的准则。