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

北京大学

作者简介:

通讯作者:

中图分类号:

基金项目:

国家自然科学基金面上项目(61972006)


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

Peking University

Fund Project:

Foundation item: General Program of National Natural Science Foundation of China (61972006)

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

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

    Abstract:

    Code review is an important mechanism in modern software distributed development. In the code review scenario, providing the context information of the current changes can help code reviewers understand the evolution process of a certain source code quickly, thus enhance the efficiency and quality of code review. The existing work has provided some commit history tracking methods and corresponding tools. However, they lack the mechanism to further extracting the code evolution information for code review. To address it, we propose a novel code change tracking approach based on commit history for fine-grained code changes named C2Tracker. Given fine-grained code changes, C2Tracker could automatically extract the history commits which are related to the code changes. Furthermore, C2Tracker could mine the frequent co-occurrence changed code elements based on the FPGrowth algorithm, and mine the most related code changes using the tree-based code change representation. Finally, C2Tracker would feedback the information to the code reviewer, thereby improving the code review and decision efficiency. We conducted experiments on 10 well-known open-source projects. The results indicate that C2Tracker can achieve the accuracy of 97% on commits extraction, the accuracy of 95% on frequent co-occurrence code elements mining, and the accuracy of 97% on mining related code changes; Through human study, it has been proven that frequent co-occurrence code element information and related code change information has a significant assistive role in improving the efficiency and quality of enhanced code review in most cases.

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

京公网安备 11040202500063号