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

开发者在拉取请求评审中如何使用代码建议?

How Do Developers Use Code Suggestions in Pull Request Reviews?

Abir Bouraffa, Yen Dieu Pham, Walid Maalej

AI总结:

本文通过对 46 个 GitHub 项目的实证研究和开发者调查,揭示了代码评审建议的四种类型、使用频率及其对合并率、解决时间和代码复杂度的影响,并发现建议更常用于新手提交者,具有知识共享工具的潜力。

摘要:

GitHub 引入了 suggestion(建议)功能,使评审者能够在拉取请求中明确建议代码修改。这些建议使评审者的反馈对提交者更具可操作性,并对新手而言代表有价值的知识。然而,关于代码评审建议如何被开发者使用、它们对拉取请求有何影响,以及它们如何受到社交编码动态的影响,目前仍知之甚少。为弥合这一知识空白,我们对来自 46 个工程化 GitHub 项目的拉取请求进行了实证研究,在这些项目中开发者使用了代码评审建议。我们采用开放式编码方法来揭示建议的类型及其使用频率。我们还挖掘了拉取请求特征,并评估了使用建议对合并率、解决时间和代码复杂度的影响。此外,我们对所研究项目的贡献者进行了调查,以深入了解社交因素对代码评审建议的使用和接受度的影响。我们能够发现四种建议类型:代码风格建议、改进、修复和文档,其中改进最为频繁。我们发现使用建议对拉取请求的合并率有积极影响,但显著增加了解决时间,且并未导致代码复杂度降低。我们的调查结果表明,当提交者是新手时,评审者更有可能使用建议。结果还表明,开发者在追踪理由或寻找代码示例时最常搜索建议。我们的工作为代码建议的使用及其作为知识共享工具的潜力提供了见解。

英文摘要:

GitHub introduced the suggestion feature to enable reviewers to explicitly suggest code modifications in pull requests. These suggestions make the reviewers' feedback more actionable for the submitters and represent a valuable knowledge for newcomers. Still, little is known about how code review suggestions are used by developers, what impact they have on pull requests, and how they are influenced by social coding dynamics. To bridge this knowledge gap, we conducted an empirical study on pull requests from 46 engineered GitHub projects, in which developers used code review suggestions. We applied an open coding approach to uncover the types of suggestions and their usage frequency. We also mined pull request characteristics and assessed the impact of using suggestions on merge rate, resolution time, and code complexity. Furthermore, we conducted a survey with contributors of the studied projects to gain insights about the influence of social factors on the usage and acceptance of code review suggestions. We were able to uncover four suggestion types: code style suggestions, improvements, fixes, and documentation with improvements being the most frequent. We found that the use of suggestions positively affects the merge rate of pull requests but significantly increases resolution time without leading to a decrease in code complexity. Our survey results show that suggestions are more likely to be used by reviewers when the submitter is a newcomer. The results also show that developers mostly search suggestions when tracking rationale or looking for code examples. Our work provides insights on the usage of code suggestions and their potential as a knowledge sharing tool.

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

↑