面向代码审查的细粒度代码变更溯源方法
作者:
作者单位:

作者简介:

王敏(1994-),男,博士,主要研究领域为软件工程,软件复用,代码审查;潘兴禄(1997-),男,硕士生,CCF学生会员,主要研究领域为软件工程,软件复用;邹艳珍(1976-),女,博士,副教授,CCF专业会员,主要研究领域为软件工程,软件复用,知识图谱,智能软件开发;谢冰(1970-),男,博士,教授,博士生导师,CCF高级会员,主要研究领域为软件工程,形式化方法,软件复用,智能软件开发.

通讯作者:

邹艳珍,E-mail:zouyz@pku.edu.cn

中图分类号:

TP311

基金项目:

国家自然科学基金(61972006)


Fine-grained Code Changes Tracking Approach for Code Review
Author:
Affiliation:

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    代码审查是现代软件分布式并行开发过程中的重要机制. 在代码评审时, 帮助代码评审者快速查看某一段源代码的演化过程, 可以让评审者快速理解此段代码变更的原因和必要性, 从而有效提升代码评审的效率与质量. 现有工作虽然提供了一些类似的代码提交历史回溯方法及对应工具, 但缺乏从历史数据中进一步提取辅助代码评审相关辅助信息的能力. 为此, 提出一个面向代码评审的细粒度代码变更溯源方法C2Tracker. 给定一段方法(函数)级别的细粒度代码变更, C2Tracker能够自动追溯到历史开发过程中修改该段代码相关的代码提交, 并在此基础上进一步挖掘其中与该段代码频繁共现修改的代码元素以及相关的变更片段, 辅助代码评审者对当前代码变更的理解与决策. 在10个著名开源项目的数据集下进行实验验证. 实验结果表明, C2Tracker在追溯历史提交的准确率上达到97%, 在挖掘频繁共现代码元素任务上的准确率达到95%, 在追溯相关代码变更片段任务上的准确率达到97%; 相比现有评审方式, C2Tracker在具体案例的代码评审效率和质量上均有较大提升, 在绝大多数的代码评审案例中被评审者认为能提供“明显帮助”或“很大帮助”.

    Abstract:

    Code review is an important mechanism in the distributed development of modern software. In code review, providing the context information of the current changes can help code reviewers understand the evolution of a certain source code quickly, thereby enhancing the efficiency and quality of code review. Existing studies have provided some commit history tracking methods and corresponding tools, but these methods cannot further extract auxiliary information relevant to code review from historical data. Therefore, this study proposes a novel code change tracking approach for code review named C2Tracker. Given a fine-grained code change at the method (function) level, C2Tracker can automatically track the history commits which are related to the code changes. Furthermore, the frequent co-occurrence changed code elements and relevant code changes are mined to help reviewers understand the current code changes and make decisions. Experimental verification is conducted on ten well-known open-source projects. The results show that the accuracy of C2Tracker in tracking historical commits, mining frequent co-occurrence code elements, and tracking related code change fragments are 97%, 95%, and 97%, respectively. Compared with existing review methods, C2Tracker greatly improves its code review efficiency and quality in specific cases. Additionally, reviewers acknowledge that it can play a significant role in helping improve the efficiency and quality of most review cases.

    参考文献
    相似文献
    引证文献
引用本文

王敏,潘兴禄,邹艳珍,谢冰.面向代码审查的细粒度代码变更溯源方法.软件学报,2023,34(10):4705-4723

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2021-09-28
  • 最后修改日期:2022-01-28
  • 录用日期:
  • 在线发布日期: 2023-04-04
  • 出版日期:
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号