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

TL;DR
AntiCopyPaster is an IDE plugin that detects code duplicates early during development, recommending refactorings to improve code quality, with high accuracy and positive developer feedback.
Contribution
It introduces a novel IDE-integrated approach with a classification model to proactively suggest refactorings for code duplicates.
Findings
Correctly recommends refactorings with an F-score of 0.82
Achieves high developer satisfaction in surveys
Operates effectively on large datasets from real projects
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Malware Detection Techniques · Software Engineering Research · Security and Verification in Computing
