A Mixed-Methods Study on the Lifecycle of Code Clones in Code Review: Understanding Developer Decision on Clone Retention and Removal. Uchoa, I., Sousa, D., Maia, P., Uchôa, A., Ragkhitwetsagul, C., Freire, S., & Paixao, M. Journal of Software Engineering Research and Development, 2026.
abstract   bibtex   
The Modern Code Review (MCR) process is iterative and asynchronous, enabling early identification of several issues during software development. Overall, code review consists of inspecting code before merging it into the codebase. Code clones are code fragments that are copied and reused across different (or the same) codebases, often with minor changes. Developers must be aware of code clones in their projects, as issues in a cloned fragment can propagate to all related clones, significantly impacting the project's maintainability. Nevertheless, there remains a gap in research on the presence and behavior of code clones during code review. By leveraging the CROP dataset (over 28k code reviews and 80k revisions) and the Siamese clone detector, we identified 27,656 relevant code clones that underwent code review across 6 software systems. A manual validation of a representative sample indicated a predominance of Type-I (46.74%) and Type-III (45.3%) clones. Based on the clones' lifecycle within the review, we categorized the reviews into Single and Recurring, depending on whether the clones are introduced and/or removed during the review process. We identified 224 reviews for which clones appear in a single review (Single) and 1,258 reviews for which clones appear in multiple revisions (Recurring). To deepen the analysis, we introduced two metrics, Duration and Distance, to assess how clones are introduced or removed during the review. We observed that, on average, clones are often introduced at the beginning of the code review, commonly surviving the review process and being merged into the codebase. To extend the lifecycle analysis, we also conducted a qualitative analysis of a stratified sample of code reviews, investigating whether developers discuss code clones during review and the reasons why clones are removed or retained. We observed that reviews with explicit discussions about code clones are more likely to occur when the clone is not merged. In particular, among the 315 sampled reviews, 10 of the 11 reviews discussing clones in the context of refactoring (90.9%) involved cases where the clone was not merged. In contrast, 5 of the 7 reviews with Unjustified / Unclear Cloning discussions (71.4%) involved clones that were merged. Given the limited number of clone-related discussions, these observations should be interpreted as exploratory rather than conclusive evidence.
@article{uchoa2026mixedmethods,
  author  = {Italo Uchoa and Denis Sousa and Pedro Maia and Anderson Uch{\^o}a and Chaiyong Ragkhitwetsagul and S{\'a}vio Freire and Matheus Paixao},
  title   = {A Mixed-Methods Study on the Lifecycle of Code Clones in Code Review: Understanding Developer Decision on Clone Retention and Removal},
  journal = {Journal of Software Engineering Research and Development},
  year    = {2026},
  abstract = {The Modern Code Review (MCR) process is iterative and asynchronous, enabling early identification of several issues during software development. Overall, code review consists of inspecting code before merging it into the codebase. Code clones are code fragments that are copied and reused across different (or the same) codebases, often with minor changes. Developers must be aware of code clones in their projects, as issues in a cloned fragment can propagate to all related clones, significantly impacting the project's maintainability. Nevertheless, there remains a gap in research on the presence and behavior of code clones during code review. By leveraging the CROP dataset (over 28k code reviews and 80k revisions) and the Siamese clone detector, we identified 27,656 relevant code clones that underwent code review across 6 software systems. A manual validation of a representative sample indicated a predominance of Type-I (46.74\%) and Type-III (45.3\%) clones. Based on the clones' lifecycle within the review, we categorized the reviews into Single and Recurring, depending on whether the clones are introduced and/or removed during the review process. We identified 224 reviews for which clones appear in a single review (Single) and 1,258 reviews for which clones appear in multiple revisions (Recurring). To deepen the analysis, we introduced two metrics, \textit{Duration} and \textit{Distance}, to assess how clones are introduced or removed during the review. We observed that, on average, clones are often introduced at the beginning of the code review, commonly surviving the review process and being merged into the codebase. To extend the lifecycle analysis, we also conducted a qualitative analysis of a stratified sample of code reviews, investigating whether developers discuss code clones during review and the reasons why clones are removed or retained. We observed that reviews with explicit discussions about code clones are more likely to occur when the clone is not merged. In particular, among the 315 sampled reviews, 10 of the 11 reviews discussing clones in the context of refactoring (90.9\%) involved cases where the clone was not merged. In contrast, 5 of the 7 reviews with \textit{Unjustified / Unclear Cloning} discussions (71.4\%) involved clones that were merged. Given the limited number of clone-related discussions, these observations should be interpreted as exploratory rather than conclusive evidence.}
}

Downloads: 0