A machine learning based framework for code clone validation

被引:8
|
作者
Mostaeen, Golam [1 ]
Roy, Banani [1 ]
Roy, Chanchal K. [1 ]
Schneider, Kevin [1 ]
Svajlenko, Jeffrey [2 ]
机构
[1] Univ Saskatchewan, Saskatoon, SK, Canada
[2] GitHub Inc, San Francisco, CA USA
基金
加拿大自然科学与工程研究理事会;
关键词
Code clones; Validation; Machine learning; Clone management; SYSTEM;
D O I
10.1016/j.jss.2020.110686
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
A code clone is a pair of code fragments, within or between software systems that are similar. Since code clones often negatively impact the maintainability of a software system, several code clone detection techniques and tools have been proposed and studied over the last decade. However, the clone detection tools are not always perfect and their clone detection reports often contain a number of false positives or irrelevant clones from specific project management or user perspective. To detect all possible similar source code patterns in general, the clone detection tools work on the syntax level while lacking user-specific preferences. This often means the clones must be manually inspected before analysis in order to remove those false positives from consideration. This manual clone validation effort is very time-consuming and often error-prone, in particular for large-scale clone detection. In this paper, we propose a machine learning approach for automating the validation process. First, a training dataset is built by taking code clones from several clone detection tools for different subject systems and then manually validating those clones. Second, several features are extracted from those clones to train the machine learning model by the proposed approach. The trained algorithm is then used to automatically validate clones without human inspection. Thus the proposed approach can be used to remove the false positive clones from the detection results, automatically evaluate the precision of any clone detectors for any given set of datasets, evaluate existing clone benchmark datasets, or even be used to build new clone benchmarks and datasets with minimum effort. In an experiment with clones detected by several clone detectors in several different software systems, we found our approach has an accuracy of up to 87.4% when compared against the manual validation by multiple expert judges. The proposed method also shows better results in several comparative studies with the existing related approaches for clone classification. (C) 2020 Elsevier Inc. All rights reserved.
引用
收藏
页数:19
相关论文
共 50 条
  • [1] CloneCognition: Machine Learning Based Code Clone Validation Tool
    Mostaeen, Golam
    Svajlenko, Jeffrey
    Roy, Banani
    Roy, Chanchal K.
    Schneider, Kevin A.
    [J]. ESEC/FSE'2019: PROCEEDINGS OF THE 2019 27TH ACM JOINT MEETING ON EUROPEAN SOFTWARE ENGINEERING CONFERENCE AND SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING, 2019, : 1105 - 1109
  • [2] On the Use of Machine Learning Techniques Towards the Design of Cloud Based Automatic Code Clone Validation Tools
    Mostaeen, Golam
    Svajlenko, Jeffrey
    Roy, Banani
    Roy, Chanchal K.
    Schneider, Kevin
    [J]. 2018 IEEE 18TH INTERNATIONAL WORKING CONFERENCE ON SOURCE CODE ANALYSIS AND MANIPULATION (SCAM), 2018, : 155 - 164
  • [3] Experiments on Code Clone Detection and Machine Learning
    Schaefer, Andre
    Amme, Wolfram
    Heinze, Thomas S.
    [J]. 2022 IEEE 16TH INTERNATIONAL WORKSHOP ON SOFTWARE CLONES (IWSC 2022), 2022, : 46 - 52
  • [4] A Conceptual Framework for Clone Detection using Machine Learning
    Ghofrani, Javad
    Mohseni, Mandi
    Bozorgmehr, Arezoo
    [J]. 2017 IEEE 4TH INTERNATIONAL CONFERENCE ON KNOWLEDGE-BASED ENGINEERING AND INNOVATION (KBEI), 2017, : 810 - 817
  • [5] LLVM-Based Code Clone Detection Framework
    Avetisyan, Arutyun
    Kurmangaleev, Shamil
    Sargsyan, Sevak
    Arutunian, Mariam
    Belevantsev, Andrey
    [J]. TENTH INTERNATIONAL CONFERENCE ON COMPUTER SCIENCE AND INFORMATION TECHNOLOGIES REVISED SELECTED PAPERS CSIT-2015, 2015, : 100 - 104
  • [6] A systematic literature review on the use of machine learning in code clone research
    Kaur, Manpreet
    Rattan, Dhavleesh
    [J]. COMPUTER SCIENCE REVIEW, 2023, 47
  • [7] Challenging Machine Learning-Based Clone Detectors via Semantic-Preserving Code Transformations
    Zhang, Weiwei
    Guo, Shengjian
    Zhang, Hongyu
    Sui, Yulei
    Xue, Yinxing
    Xu, Yun
    [J]. IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2023, 49 (05) : 3052 - 3070
  • [8] Semantic Clone Detection Based on Code Feature Fusion Learning
    Zhang, Qianjin
    Jin, Dahai
    Wang, Yawen
    Gong, Yunzhan
    [J]. INTERNATIONAL JOURNAL OF SOFTWARE ENGINEERING AND KNOWLEDGE ENGINEERING, 2023, 33 (07) : 1039 - 1062
  • [9] Malicious code clone detection technology based on deep learning
    Shen, Yuan
    Yan, Hanbing
    Xia, Chunhe
    Han, Zhihui
    [J]. Beijing Hangkong Hangtian Daxue Xuebao/Journal of Beijing University of Aeronautics and Astronautics, 2022, 48 (02): : 282 - 290
  • [10] TPCaps: a framework for code clone detection and localization based on improved CapsNet
    Li, Yuancheng
    Yu, Chaohang
    Cui, Yaqi
    [J]. APPLIED INTELLIGENCE, 2023, 53 (13) : 16594 - 16605