Framing Program Repair as Code Completion

被引:3
|
作者
Ribeiro, Francisco [1 ]
Abreu, Rui [2 ,3 ]
Saraiva, Joao [1 ]
机构
[1] Univ Minho, HASLab INESC TEC, Braga, Portugal
[2] Univ Porto, INESC ID, Porto, Portugal
[3] Univ Porto, FEUP, Porto, Portugal
基金
美国安德鲁·梅隆基金会;
关键词
program repair; code generation; code completion;
D O I
10.1145/3524459.3527347
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Many techniques have contributed to the advancement of automated program repair, such as: generate and validate approaches, constraint-based solvers and even neural machine translation. Simultaneously, artificial intelligence has allowed the creation of general-purpose pre-trained models that support several downstream tasks. In this paper, we describe a technique that takes advantage of a generative model - CodeGPT - to automatically repair buggy programs by making use of its code completion capabilities. We also elaborate on where to perform code completion in a buggy line and how we circumvent the open-ended nature of code generation to appropriately fit the new code in the original program. Furthermore, we validate our approach on the ManySStuBs4j dataset containing real-world open-source projects and show that our tool is able to fix 1739 programs out of 6415 - a 27% repair rate. The repaired programs range from single-line changes to multiple line modifications. In fact, our technique is able to fix programs which were missing relatively complex expressions prior to being analyzed. In the end, we present case studies that showcase different scenarios our technique was able to handle.
引用
收藏
页码:38 / 45
页数:8
相关论文
共 50 条
  • [21] Survey of Intelligent Code Completion
    Yang B.
    Zhang N.
    Li S.-P.
    Xia X.
    Ruan Jian Xue Bao/Journal of Software, 2020, 31 (05): : 1435 - 1453
  • [22] A comprehensive study of code-removal patches in automated program repair
    Ginelli, Davide
    Martinez, Matias
    Mariani, Leonardo
    Monperrus, Martin
    EMPIRICAL SOFTWARE ENGINEERING, 2022, 27 (04)
  • [23] Identifying Incorrect Patches in Program Repair Based on Meaning of Source Code
    Quang-Ngoc Phung
    Kim, Misoo
    Lee, Eunseok
    IEEE ACCESS, 2022, 10 : 12012 - 12030
  • [24] Temporal Code Completion and Navigation
    Lee, Yun Young
    Harwell, Sam
    Khurshid, Sarfraz
    Marinov, Darko
    PROCEEDINGS OF THE 35TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2013), 2013, : 1181 - 1184
  • [25] A Novel Code Completion Strategy
    Oumarou, Hayatou
    Dahirou, Ousmanou
    INTERNATIONAL JOURNAL OF ADVANCED COMPUTER SCIENCE AND APPLICATIONS, 2022, 13 (05) : 866 - 871
  • [26] Doctor Code: A machine learning-based approach to program repair
    Moosavi, Sh
    Vahidi-Asl, M.
    Haghighi, H.
    Rezaalipour, M.
    Scientia Iranica, 2024, 31 (02) : 83 - 102
  • [27] DLFix: Context-based Code Transformation Automated Program Repair
    Li, Yi
    Wang, Shaohua
    Nguyen, Tien N.
    2020 ACM/IEEE 42ND INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2020), 2020, : 602 - 614
  • [28] A comprehensive study of code-removal patches in automated program repair
    Davide Ginelli
    Matias Martinez
    Leonardo Mariani
    Martin Monperrus
    Empirical Software Engineering, 2022, 27
  • [29] Automated Program Repair by Using Similar Code Containing Fix Ingredients
    Ji, Tao
    Chen, Liqian
    Mao, Xiaoguang
    Yi, Xin
    PROCEEDINGS 2016 IEEE 40TH ANNUAL COMPUTER SOFTWARE AND APPLICATIONS CONFERENCE WORKSHOPS, VOL 1, 2016, : 197 - 202
  • [30] Cyanide code nears completion
    Anon
    2002, Primedia Intertec Publishing Corp. (203):