Automating Just-In-Time Comment Updating
Zhongxin Liu, Xin Xia, Meng Yan, Shanping Li
摘要
Code comments are valuable for program comprehension and software maintenance, and also require maintenance with code evolution. However, when changing code, developers sometimes neglect updating the related comments, bringing in inconsistent or obsolete comments (aka., bad comments). Such comments are detrimental since they may mislead developers and lead to future bugs. Therefore, it is necessary to fix and avoid bad comments. In this work, we argue that bad comments can be reduced and even avoided by automatically performing comment updates with code changes. We refer to this task as "Just-In-Time (JIT) Comment Updating" and propose an approach named CUP (<u>C</u>omment <u>UP</u>dater) to automate this task. CUP can be used to assist developers in updating comments during code changes and can consequently help avoid the introduction of bad comments. Specifically, CUP leverages a novel neural sequence-to-sequence model to learn comment update patterns from extant code-comment co-changes and can automatically generate a new comment based on its corresponding old comment and code change. Several customized enhancements, such as a special tokenizer and a novel co-attention mechanism, are introduced in CUP by us to handle the characteristics of this task. We build a dataset with over 108K comment-code co-change samples and evaluate CUP on it. The evaluation results show that CUP outperforms an information-retrieval-based and a rule-based baselines by substantial margins, and can reduce developers' edits required for JIT comment updating. In addition, the comments generated by our approach are identical to those updated by developers in 1612 (16.7%) test samples, 7 times more than the best-performing baseline.
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了每一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
引用它的顶会 Paper12
- CCT5: A Code-Change-Oriented Pre-trained ModelBo Lin, Shangwen Wang, Zhongxin Liu, Yepang Liu 等FSE 2023 · 被引用 69 次
- Practitioners' Expectations on Automated Code Comment GenerationXing Hu, Xin Xia, David Lo, Zhiyuan Wan 等ICSE 2022 · 被引用 50 次
- Automating the removal of obsolete TODO commentsZhipeng Gao, Xin Xia, David Lo, John C. Grundy 等FSE 2021 · 被引用 34 次
- CCRep: Learning Code Change Representations via Pre-Trained Code Model and Query BackZhongxin Liu, Zhijie Tang, Xin Xia, Xiaohu YangICSE 2023 · 被引用 25 次
- Impact of Evaluation Methodologies on Code SummarizationPengyu Nie, Jiyang Zhang, Junyi Jessy Li, Raymond J. Mooney 等ACL 2022 · 被引用 21 次
它引用的顶会 Paper1
相关 Paper
- Deep Just-In-Time Inconsistency Detection Between Comments and Source CodeSheena Panthaplackel, Junyi Jessy Li, Milos Gligoric, Raymond J. MooneyAAAI 2021 · 被引用 62 次
- Learning to Update Natural Language Comments Based on Code ChangesSheena Panthaplackel, Pengyu Nie, Milos Gligoric, Junyi Jessy Li 等ACL 2020 · 被引用 1 次
- Retrieve and Refine: Exemplar-based Neural Comment GenerationBolin Wei, Yongmin Li, Ge Li, Xin Xia 等ASE 2020 · 被引用 68 次
- Automating Just-In-Time Python Type Annotation UpdatingZhipeng Xue, Zhipeng Gao, Xing Hu, Jingyuan Chen 等ICSE 2026
- Data Quality Matters: A Case Study of Obsolete Comment DetectionShengbin Xu, Yuan Yao, Feng Xu, Tianxiao Gu 等ICSE 2023 · 被引用 7 次
