kirancodes.me
To Proof Maintenance & Beyond!

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 Dilip Kini, Aditya Thakur

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.

BibTeX
@inproceedings{AlOmar-al:ASE22,
  author    = {Eman Abdullah AlOmar and
               Anton Ivanov and
               Zarina Kurbatova and
               Yaroslav Golubev and
               Mohamed Wiem Mkaouer and
               Ali Ouni and
               Timofey Bryksin and
               Le Nguyen and
               Amit Dilip Kini and
               Aditya Thakur},
  title     = {{AntiCopyPaster:} Extracting Code Duplicates As Soon As They Are Introduced in the {IDE}},
  booktitle = {ASE},
  pages     = {152:1--152:4},
  publisher = {{ACM}},
  year      = {2022},
}

Related papers