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

基于Token的微提交的实证研究

An Empirical Study of Token-based Micro Commits

Masanari Kondo, Daniel M. German, Yasutaka Kamei, Naoyasu Ubayashi, Osamu Mizuno

AI总结:

本研究针对现有小型变更定义丢失行内token信息的局限,提出基于变更token的微提交概念,通过四个OSS项目实证其特征,并提出用token级信息支撑相关软件工程方法。

摘要:

在软件开发中,开发者经常通过单次提交对源代码执行仅改动几行的维护活动。深入理解这类小型变更的特征能够支撑质量保障方法(例如自动化程序修复),因为小型变更很可能是在修正其他变更中存在的缺陷;因此,理解产生小型变更的原因有助于厘清被引入的错误类型。最终,这些原因和错误类型可用于强化质量保障方法,以提升代码质量。尽管已有研究使用代码 churn(代码 churn)来表征和研究小型变更,但该定义存在一个关键局限。具体而言,它丢失了代码行内被变更token的信息。例如,该定义无法区分以下两种单行变更:(1)修改字符串字面量以修复显示消息,以及(2)修改函数调用并新增一个参数。这两类显然都属于维护活动,但我们推断研究者和从业者更关注对后一种变更的支撑。为解决这一局限,本文定义了微提交(micro commits)——一种基于变更token的小型变更类型。我们的目标是利用变更token对小型变更进行量化。变更token让我们能够更精准地识别小型变更。事实上,这种token级别的定义能够区分上述示例。我们在四个OSS项目中对所定义的微提交展开调研,作为首项针对基于token的微提交的实证研究,梳理其特征。我们发现微提交主要替换单个名称或字面量token,且微提交更常被用于修复漏洞。此外,我们提出利用基于token的信息来支撑那些极小变更会显著影响其有效性的软件工程方法。

英文摘要:

In software development, developers frequently apply maintenance activities to the source code that change a few lines by a single commit. A good understanding of the characteristics of such small changes can support quality assurance approaches (e.g., automated program repair), as it is likely that small changes are addressing deficiencies in other changes; thus, understanding the reasons for creating small changes can help understand the types of errors introduced. Eventually, these reasons and the types of errors can be used to enhance quality assurance approaches for improving code quality. While prior studies used code churns to characterize and investigate the small changes, such a definition has a critical limitation. Specifically, it loses the information of changed tokens in a line. For example, this definition fails to distinguish the following two one-line changes: (1) changing a string literal to fix a displayed message and (2) changing a function call and adding a new parameter. These are definitely maintenance activities, but we deduce that researchers and practitioners are interested in supporting the latter change. To address this limitation, in this paper, we define micro commits, a type of small change based on changed tokens. Our goal is to quantify small changes using changed tokens. Changed tokens allow us to identify small changes more precisely. In fact, this token-level definition can distinguish the above example. We investigate defined micro commits in four OSS projects and understand their characteristics as the first empirical study on token-based micro commits. We find that micro commits mainly replace a single name or literal token, and micro commits are more likely used to fix bugs. Additionally, we propose the use of token-based information to support software engineering approaches in which very small changes significantly affect their effectiveness.

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

↑