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

缺陷识别、分类和修复:更好地结合在一起

Defect Identification, Categorization, and Repair: Better Together

Chao Ni, Kaiwen Yang, Xin Xia, David Lo, Xiang Chen, Xiaohu Yang

摘要:

即时缺陷预测(JIT-DP)模型可以在签入时识别导致缺陷的提交。尽管以往的研究已经取得了很大的进展,但这些研究仍然存在以下局限性:1)有用的信息(例如,语义信息和结构信息)没有被充分利用; 2)现有的工作只能预测一个提交是错误的还是干净的,而没有更多关于它是什么类型的缺陷的信息; 3)一个提交可能涉及许多文件中的更改,这导致难以定位缺陷; 4)现有的研究将缺陷识别和缺陷修复作为单独的任务,没有一个旨在同时处理这两个任务。在本文中,为了处理上述限制,我们提出了一个名为CompDefect的综合缺陷预测和修复框架,它可以识别更改的功能(更细粒度的级别)是否容易出现缺陷,对缺陷类型进行分类,并在缺陷落入几种场景时自动修复此类缺陷,例如,具有单个语句修复的缺陷,或者那些与一小组缺陷模板匹配的缺陷。通常,CompDefect中的前两个任务被视为多类分类任务,而最后一个任务被视为序列生成任务。CompDefect的整个输入由三个部分组成(以正函数为例):函数的干净版本(即,引入缺陷之前的版本)、函数的错误版本和函数的修复版本。在多类分类任务中,CompDefect通过多类分类对缺陷类型进行分类,其中包含干净版本和错误版本中的信息。在代码序列生成任务中,CompDefect一旦识别出缺陷就修复缺陷或保持缺陷不变。

英文摘要:

Just-In-Time defect prediction (JIT-DP) models can identify defect-inducing commits at check-in time. Even though previous studies have achieved a great progress, these studies still have the following limitations: 1) useful information (e.g., semantic information and structure information) are not fully used; 2) existing work can only predict a commit as buggy one or clean one without more information about what type of defect it is; 3) a commit may involve changes in many files, which cause difficulty in locating the defect; 4) prior studies treat defect identification and defect repair as separate tasks, none aims to handle both tasks simultaneously. In this paper, to handle aforementioned limitations, we propose a comprehensive defect prediction and repair framework named CompDefect, which can identify whether a changed function (a more fine-grained level) is defect-prone, categorize the type of defect, and repair such a defect automatically if it falls into several scenarios, e.g., defects with single statement fixes, or those that match a small set of defect templates. Generally, the first two tasks in CompDefect are treated as a multiclass classification task, while the last one is treated as a sequence generation task. The whole input of CompDefect consists of three parts (exampled with positive functions): the clean version of a function (i.e., the version before defect introduced), the buggy version of a function and the fixed version of a function. In multiclass classification task, CompDefect categorizes the type of defect via multiclass classification with the information in both the clean version and the buggy version. In code sequence generation task, CompDefect repairs the defect once identified or keeps it unchanged.

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

↑