arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2112.15230cs.SE
收藏

AntiCopyPaster:在IDE中引入代码副本后立即提取代码副本

AntiCopyPaster: Extracting Code Duplicates As Soon As They Are Introduced in the IDE

Eman Abdullah AlOmar, Anton Ivanov, Zarina Kurbatova, Yaroslav Golubev, Mohamed Wiem Mkaouer, Ali Ouni, Timofey Bryksin, Le Nguyen, Amit Kini, Aditya Thakur

摘要:

我们为IntelliJ IDEA开发了一个名为AntiCopyPaster的插件,它可以跟踪IDE内代码片段的粘贴,并建议适当的提取方法重构以防止重复的传播。与现有的方法不同,我们的工具与开发人员的工作流程集成在一起,并主动推荐重构。由于不是所有的代码片段都需要提取,我们开发了一个分类模型来做出这个决定。当开发人员复制并粘贴代码片段时,插件会在当前打开的文件中搜索重复的代码,等待一小段时间以允许开发人员编辑代码,最后根据许多功能推断重构决策。我们对从13个Apache项目中挖掘的18,942个代码片段的大型数据集进行了实验研究,结果表明AntiCopyPaster正确地推荐了F-score为0.82的Extract Method重构。此外,我们对59名开发人员的调查反映了他们对开发的插件的操作的满意度。该插件及其源代码可在GitHub上公开获取,网址为https://github.com/JetBrains-Research/anti-copy-paster。演示视频可以在YouTube上找到:https://youtu.be/_wwHg-qFjJY。

英文摘要:

We developed a plugin for IntelliJ IDEA called AntiCopyPaster, which tracks the pasting of code fragments inside the IDE and suggests the appropriate Extract Method refactoring to combat the propagation of duplicates. Unlike the existing approaches, our tool is integrated with the developer's workflow, and pro-actively recommends refactorings. Since not all code fragments need to be extracted, we develop a classification model to make this decision. When a developer copies and pastes a code fragment, the plugin searches for duplicates in the currently opened file, waits for a short period of time to allow the developer to edit the code, and finally inferences the refactoring decision based on a number of features. Our experimental study on a large dataset of 18,942 code fragments mined from 13 Apache projects shows that AntiCopyPaster correctly recommends Extract Method refactorings with an F-score of 0.82. Furthermore, our survey of 59 developers reflects their satisfaction with the developed plugin's operation. The plugin and its source code are publicly available on GitHub at https://github.com/JetBrains-Research/anti-copy-paster. The demonstration video can be found on YouTube: https://youtu.be/_wwHg-qFjJY.

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

↑