面向代码审查的细粒度代码变更溯源方法  

Fine-grained Code Changes Tracking Approach for Code Review

在线阅读下载全文

作  者:王敏 潘兴禄 邹艳珍[1,2] 谢冰 WANG Min;PAN Xing-Lu;ZOU Yan-Zhen;XIE Bing(Key Laboratory of High Confidence Software Technologies(Peking University),Ministry of Education,Beijing 100871,China;School of Computer Science,Peking University,Beijing 100871,China)

机构地区:[1]高可信软件技术教育部重点实验室(北京大学),北京100871 [2]北京大学计算机学院,北京100871

出  处:《软件学报》2023年第10期4705-4723,共19页Journal of Software

基  金:国家自然科学基金(61972006)。

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

关 键 词:代码评审 历史溯源 频繁项集挖掘 相关代码变更 

分 类 号:TP311[自动化与计算机技术—计算机软件与理论]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象