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

自动删除有障碍的TODO注释

Automating the Removal of Obsolete TODO Comments

Zhipeng Gao, Xin Xia, David Lo, John Grundy, Thomas Zimmermann

摘要:

TODO注释被软件开发人员广泛用于描述他们在软件开发期间的未决任务。然而,在执行任务后,开发人员有时会忽略或忘记删除TODO注释,导致TODO注释过时。这些过时的TODO注释会使开发团队感到困惑,并可能导致将来引入错误,从而降低软件的质量和可维护性。在这项工作中,我们提出了一种新的模型,名为TDCleaner(TODO注释清洁),以确定过时的TODO评论在软件项目。TDCleaner可以帮助开发人员及时检查TODO注释状态,避免留下过时的TODO注释。我们的方法有两个主要阶段:离线学习和在线预测。在离线学习过程中,我们首先自动建立<code_change,todo_comment,commit_msg>训练样本,并利用三个神经编码器分别捕获TODO注释,代码更改和提交消息的语义特征。然后,TDCleaner会自动学习不同编码器之间的相关性和相互作用,以估计TODO注释的最终状态。对于在线预测,我们通过利用离线训练模型来判断TODO评论过时的可能性来检查TODO评论的状态。我们通过从前10,000个Python和Java Github存储库中收集TODO评论来构建数据集,并在其上评估TDCleaner。大量的实验结果表明,我们的模型在一组基准测试的有前途的性能。我们还对真实世界的软件项目进行了野外评估,我们向Github开发人员报告了TDCleaner识别的18条过时的TODO注释,其中9条已经被开发人员确认并删除,这证明了我们方法的实际使用。

英文摘要:

TODO comments are very widely used by software developers to describe their pending tasks during software development. However, after performing the task developers sometimes neglect or simply forget to remove the TODO comment, resulting in obsolete TODO comments. These obsolete TODO comments can confuse development teams and may cause the introduction of bugs in the future, decreasing the software's quality and maintainability. In this work, we propose a novel model, named TDCleaner (TODO comment Cleaner), to identify obsolete TODO comments in software projects. TDCleaner can assist developers in just-in-time checking of TODO comments status and avoid leaving obsolete TODO comments. Our approach has two main stages: offline learning and online prediction. During offline learning, we first automatically establish <code_change, todo_comment, commit_msg> training samples and leverage three neural encoders to capture the semantic features of TODO comment, code change and commit message respectively. TDCleaner then automatically learns the correlations and interactions between different encoders to estimate the final status of the TODO comment. For online prediction, we check a TODO comment's status by leveraging the offline trained model to judge the TODO comment's likelihood of being obsolete. We built our dataset by collecting TODO comments from the top-10,000 Python and Java Github repositories and evaluated TDCleaner on them. Extensive experimental results show the promising performance of our model over a set of benchmarks. We also performed an in-the-wild evaluation with real-world software projects, we reported 18 obsolete TODO comments identified by TDCleaner to Github developers and 9 of them have already been confirmed and removed by the developers, demonstrating the practical usage of our approach.

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

↑