arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2309.02594cs.SE
收藏

开发者如何提升代码可读性?对拉取请求的实证研究

How do Developers Improve Code Readability? An Empirical Study of Pull Requests

Carlos Eduardo C. Dantas, Adriano M. Rocha, Marcelo A. Maia

AI总结:

本研究通过分析109个GitHub仓库中284个合并拉取请求的370项代码可读性改进,构建了26种改进类型的目录,发现SonarQube仅检测到其中26项,凸显了自动静态分析工具规则的改进空间。

摘要:

可读性模型和工具已被提出用于衡量阅读代码所需付出的努力。然而,这些模型并不能完全捕捉开发者所感知到的代码质量改进。为了探究新可读性模型和生产级工具的潜在特征,我们旨在更好地理解开发者在实际提升代码可读性时所执行的可读性改进类型,并识别自动静态工具的建议与开发者实际执行的改进之间的差异。我们从109个GitHub仓库下的284个已合并拉取请求(PRs)中收集了370项代码可读性改进,并生成了一个包含26种不同类型代码可读性改进的目录,其中在大多数场景中,开发者提升了代码可读性,使其更加直观、模块化且不那么冗长。令人惊讶的是,SonarQube仅检测到370项代码可读性改进中的26项。这表明所生成的目录中的某些改进尚未被SonarQube规则覆盖,凸显了自动静态分析工具(ASAT)代码可读性规则在开发者感知方面存在改进潜力。

英文摘要:

Readability models and tools have been proposed to measure the effort to read code. However, these models are not completely able to capture the quality improvements in code as perceived by developers. To investigate possible features for new readability models and production-ready tools, we aim to better understand the types of readability improvements performed by developers when actually improving code readability, and identify discrepancies between suggestions of automatic static tools and the actual improvements performed by developers. We collected 370 code readability improvements from 284 Merged Pull Requests (PRs) under 109 GitHub repositories and produce a catalog with 26 different types of code readability improvements, where in most of the scenarios, the developers improved the code readability to be more intuitive, modular, and less verbose. Surprisingly, SonarQube only detected 26 out of the 370 code readability improvements. This suggests that some of the catalog produced has not yet been addressed by SonarQube rules, highlighting the potential for improvement in Automatic static analysis tools (ASAT) code readability rules as they are perceived by developers.

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

↑