A Mixed-Methods Study on the Lifecycle of Code Clones in Code Review
DOI:
https://doi.org/10.5753/jserd.2026.8113Keywords:
Modern Code Review, Code Clones, Empirical StudyAbstract
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 in 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.
Downloads
References
Ain, Q. U., Butt, W. H., Anwar, M. W., Azam, F., and Maqbool, B. (2019). A systematic review on code clone detection. IEEE Access, 7:86121–86144.
Bacchelli, A. and Bird, C. (2013). Expectations, outcomes, and challenges of modern code review. In 2013 35th International Conference on Software Engineering (ICSE), pages 712–721. IEEE.
Cohen, J. (2010). Modern code review. In Making Software: What Really Works, and Why We Believe It, pages 329–336.
Feitelson, D. G., Frachtenberg, E., and Beck, K. L. (2013). Development and deployment at Facebook. IEEE Internet Computing, 17(4):8–17.
Fowler, M. and Beck, K. (1999). Refactoring: Improving the Design of Existing Code. Addison-Wesley.
Islam, J. F., Mondal, M., and Roy, C. K. (2016). Bug replication in code clones: An empirical study. In 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER), volume 1, pages 68–78. IEEE.
Jiang, J., Lv, J., Zheng, J., and Zhang, L. (2021). How developers modify pull requests in code review. IEEE Transactions on Reliability, 71(3):1325–1339.
Kamiya, T., Kusumoto, S., and Inoue, K. (2002). CCFinder: A multilinguistic token-based code clone detection system for large-scale source code. IEEE Transactions on Software Engineering, 28(7):654–670.
Kapser, C. J. and Godfrey, M. W. (2008). "Cloning considered harmful" considered harmful: Patterns of cloning in software. Empirical Software Engineering, 13(6):645–692.
McIntosh, S., Kamei, Y., Adams, B., and Hassan, A. E. (2016). An empirical study of the impact of modern code review practices on software quality. Empirical Software Engineering, 21:2146–2189.
Mondai, M., Roy, C. K., and Schneider, K. A. (2018). Micro-clones in evolving software. In 2018 IEEE 25th International Conference on Software Analysis, Evolution and Reengineering (SANER), pages 50–60.
Mondal, M., Roy, B., Roy, C. K., and Schneider, K. A. (2019). Investigating context adaptation bugs in code clones. In 2019 IEEE International Conference on Software Maintenance and Evolution (ICSME), pages 157–168. IEEE.
Paixao, M., Krinke, J., Han, D., and Harman, M. (2018). CROP: Linking code reviews to source code changes. In Proceedings of the IEEE/ACM 15th International Conference on Mining Software Repositories (MSR), pages 46–49. Association for Computing Machinery.
Paixao, M., Krinke, J., Han, D., Ragkhitwetsagul, C., and Harman, M. (2021). The impact of code review on architectural changes. IEEE Transactions on Software Engineering, 47(5):1041–1059.
Paixao, M. and Maia, P. H. (2019). Rebasing in code review considered harmful: A large-scale empirical investigation. In 2019 19th International Working Conference on Source Code Analysis and Manipulation (SCAM), pages 45–55. IEEE.
Paixão, M., Uchôa, A., Bibiano, A. C., Oliveira, D., Garcia, A., Krinke, J., and Arvonio, E. (2020). Behind the intents: An in-depth empirical study on software refactoring in modern code review. In Proceedings of the 17th International Conference on Mining Software Repositories (MSR), pages 125–136.
Pascarella, L., Spadini, D., Palomba, F., and Bacchelli, A. (2019). On the effect of code review on code smells. arXiv preprint arXiv:1912.10098.
Ragkhitwetsagul, C. and Krinke, J. (2019). Siamese: Scalable and incremental code clone search via multiple code representations. Empirical Software Engineering, 24(4):2236–2284.
Ragkhitwetsagul, C., Krinke, J., Paixao, M., Bianco, G., and Oliveto, R. (2021). Toxic code snippets on Stack Overflow. IEEE Transactions on Software Engineering, 47(3):560–581.
Roy, C. K., Zibran, M. F., and Koschke, R. (2014). The vision of software clone management: Past, present, and future (keynote paper). In 2014 Software Evolution Week – IEEE Conference on Software Maintenance, Reengineering, and Reverse Engineering (CSMR-WCRE), pages 18–33. IEEE.
Sadowski, C., Söderberg, E., Church, L., Sipko, M., and Bacchelli, A. (2018). Modern code review: A case study at Google. In Proceedings of the 40th International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP), pages 181–190.
Shobha, G., Rana, A., Kansal, V., and Tanwar, S. (2021). Code clone detection—A systematic review. In Emerging Technologies in Data Mining and Information Security: Proceedings of IEMIS 2020, Volume 2, pages 645–655.
Sousa, D., Paixao, M., Ragkhitwetsagul, C., and Uchoa, I. (2024). Code clone configuration as a multi-objective search problem. In Proceedings of the 18th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), pages 503–509.
Svajlenko, J., Islam, J. F., Keivanloo, I., Roy, C. K., and Mia, M. M. (2014). Towards a big data curated benchmark of inter-project code clones. In 2014 IEEE International Conference on Software Maintenance and Evolution (ICSME), pages 476–480. IEEE.
Thompson, C. and Wagner, D. (2017). A large-scale study of modern code review and security in open source projects. In Proceedings of the 13th International Conference on Predictive Models and Data Analytics in Software Engineering (PROMISE), pages 83–92.
Uchôa, A., Barbosa, C., Coutinho, D., Oizumi, W., Assunção, W. K., Vergilio, S. R., Pereira, J. A., Oliveira, A., and Garcia, A. (2021). Predicting design impactful changes in modern code review: A large-scale empirical study. In 2021 IEEE/ACM 18th International Conference on Mining Software Repositories (MSR), pages 471–482. IEEE.
Uchôa, A., Barbosa, C., Oizumi, W., Blenílio, P., Lima, R., Garcia, A., and Bezerra, C. (2020). How does modern code review impact software design degradation? An in-depth empirical study. In 2020 IEEE International Conference on Software Maintenance and Evolution (ICSME), pages 511–522. IEEE.
Uchoa, I., Sousa, D., Maia, P., Uchoa, A., Ragkhitwetsagul, C., Freire, S., and Paixao, M. (2026). Replication package for the paper: "A Mixed-Methods Study on the Lifecycle of Code Clones in Code Review". [link].
Uchoa, I., Sousa, D., Paixao, M., Maia, P., Uchoa, A., and Ragkhitwetsagul, C. (2025a). Exploring code clone behavior in modern code review. pages 606–608.
Uchoa, I., Sousa, D., Paixao, M., Ulisses, P., Uchoa, A., and Ragkhitwetsagul, C. (2025b). An exploratory study on the lifecycle of code clones during code review. In Brazilian Symposium on Software Engineering (SBES), Recife, Brazil.
van Bladel, B. and Demeyer, S. (2021). A comparative study of test code clones and production code clones. Journal of Systems and Software, 176:110940.
Wang, T., Harman, M., Jia, Y., and Krinke, J. (2013). Searching for better configurations: A rigorous approach to clone evaluation. In Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering (ESEC/FSE), pages 455–465.
Wang, W. and Godfrey, M. (2014). Investigating intentional clone refactoring. Electronic Communications of the EASST, 63.
Wang, W., Li, G., Ma, B., Xia, X., and Jin, Z. (2020). Detecting code clones with graph neural network and flow-augmented abstract syntax tree. In 2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER), pages 261–271. IEEE.
Wohlin, C., Runeson, P., Höst, M., Ohlsson, M. C., Regnell, B., and Wesslén, A. (2012). Experimentation in Software Engineering. Springer Science & Business Media.
Yu, Y., Wang, H., Yin, G., and Wang, T. (2016). Reviewer recommendation for pull requests in GitHub: What can we learn from code review and bug assignment? Information and Software Technology, 74:204–218.
Zakeri-Nasrabadi, M., Parsa, S., Ramezani, M., Roy, C., and Ekhtiarzadeh, M. (2023). A systematic literature review on source code similarity measurement and clone detection: Techniques, applications, and challenges. Journal of Systems and Software, 204:111796.
Zampetti, F., Bavota, G., Canfora, G., and Di Penta, M. (2019). A study on the interplay between pull request review and continuous integration builds. In 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER), pages 38–48. IEEE.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Italo Uchoa, Denis Sousa, Pedro Maia, Anderson Uchôa, Chaiyong Ragkhitwetsagul, Sávio Freire, Matheus Paixao

This work is licensed under a Creative Commons Attribution 4.0 International License.

