Abstract
Automated Program Repair (APR) presents the promising momentum of releasing developers from the burden of manual debugging tasks by automatically fixing bugs in various ways. Recent advances in deep learning inspire many works in employing deep learning techniques to fixing buggy programs. However, several challenges remain unaddressed: (1) state-of-the-art fault localization techniques often require additional artifacts, such as bug-triggering test cases or bug reports. These artifacts are not always available in the early development phases; (2) Sequence-to-Sequence model-based APR often requires additional contexts with high quality to generate patches. Yet, it is challenging to identify high-quality contexts that are not common in programs.
In this paper, with the redundancy assumption in program repair, we propose a dual deeplearning-based APR tool, Ratchet, for localizing (Ratchet-FL) and repairing (Ratchet-PG) buggy programs. Ratchet-FL localizes buggy statements based on the feature learned by a simple BiLSTM model from the code, without any bug-triggering test cases or bug reports. Ratchet-PG relies on our proposed retrieval augmented transformer to learn the historical patches and generate patches for fixing bugs. We evaluate the effectiveness of Ratchet with in-the-lab DrRepair dataset and in-the-wild dataset Ratchet-DS (curated in this work). Our experimental results show that Ratchet outperforms state-of-the-art deep learning approaches on fault localization with 39.8-96.4% accuracy and patch generation with 18.4-46.4% repair accuracy.
Our code and data are available at link.
please download the `ratchet_master.zip` and "ratchetds.zip", then unzip them.
Ratchet Tutorial
Steps to set up Ratchet,
1. Clone Ratchet:
git clone [repo] ## will publish after anonymous done
2. Change working environment
More commands about Ratchet
We crawled all the commits of the projects at October 2023, and employed a keyword filtering process to extract bug-fixing commits by checking whether the message of a commit contains one of the bug-fixing related keywords (e.g.,The keywords include “fixes, solve, repair, bug, issue, problem, error, fault, vulnerab, CVE, exploit, CVEs.” )