arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2203.15577cs.SE
收藏

在代码评审中理解代码段:对OpenStack社区的初步研究

Understanding Code Snippets in Code Reviews: A Preliminary Study of the OpenStack Community

Liming Fu, Peng Liang, Beiqi Zhang

摘要:

代码评审是软件开发中一种成熟的软件质量保证实践,评审员通过评审员检查开发人员提交的代码,并验证代码的质量。在代码评审讨论期间,评审者和开发人员可能会使用代码片段来提供必要的信息(例如,建议或解释)。然而,很少有人知道的意图和影响的代码片段在代码审查。为此,我们进行了一项初步研究,以调查代码片段的性质及其在代码审查中的用途。我们手动收集并检查了来自OpenStack社区的Nova和Neutron项目的10,790条评论,最终获得了626条包含代码片段的评论,以供进一步分析。结果表明:(1)代码片段在代码评审中的使用并不普遍,大多数代码片段都是由评审者提供的。(2)我们确定了审阅者提供的代码片段的两个高级目的(即,建议和引用),其中,改进代码实现是最常见的目的。(3)在以建议为目的的代码评审中,大约68.1%的代码片段被开发人员接受。结果突出了在代码审查中使用代码片段的有前途的研究方向。

英文摘要:

Code review is a mature practice for software quality assurance in software development with which reviewers check the code that has been committed by developers, and verify the quality of code. During the code review discussions, reviewers and developers might use code snippets to provide necessary information (e.g., suggestions or explanations). However, little is known about the intentions and impacts of code snippets in code reviews. To this end, we conducted a preliminary study to investigate the nature of code snippets and their purposes in code reviews. We manually collected and checked 10,790 review comments from the Nova and Neutron projects of the OpenStack community, and finally obtained 626 review comments that contain code snippets for further analysis. The results show that: (1) code snippets are not prevalently used in code reviews, and most of the code snippets are provided by reviewers. (2) We identified two high-level purposes of code snippets provided by reviewers (i.e., Suggestion and Citation) with six detailed purposes, among which, Improving Code Implementation is the most common purpose. (3) For the code snippets in code reviews with the aim of suggestion, around 68.1% was accepted by developers. The results highlight promising research directions on using code snippets in code reviews.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑