BashExplainer: Retrieval-Augmented Bash Code Comment Generation based on Fine-tuned CodeBERT

Chi Yu, Guang Yang, Xiang Chen, Ke Liu, Yanlin Zhou
6/27/2022
cs.SE
rag

Official code: NTDXYG/BASHEXPLAINER (12 stars, Python, Apache-2.0, last commit 2022-06-23).

Abstract

Developers use shell commands for many tasks, such as file system management, network control, and process management. Bash is one of the most commonly used shells and plays an important role in Linux system development and maintenance.

Show full abstract

Due to the language flexibility of Bash code, developers who are not familiar with Bash often have difficulty understanding the purpose and functionality of Bash code. In this study, we study Bash code comment generation problem and proposed an automatic method BashExplainer based on two-stage training strategy. In the first stage, we train a Bash encoder by fine-tuning CodeBERT on our constructed Bash code corpus. In the second stage, we first retrieve the most similar code from the code repository for the target code based on semantic and lexical similarity. Then we use the trained Bash encoder to generate two vector representations. Finally, we fuse these two vector representations via the fusion layer and generate the code comment through the decoder. To show the competitiveness of our proposed method, we construct a high-quality corpus by combining the corpus shared in the previous NL2Bash study and the corpus shared in the NLC2CMD competition. This corpus contains 10,592 Bash codes and corresponding comments. Then we selected ten baselines from previous studies on automatic code comment generation, which cover information retrieval methods, deep learning methods, and hybrid methods.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

code and data for paper "BASHEXPLAINER: Retrieval-Augmented Bash Code Comment Generation based on Fine-tuned CodeBERT", which accepted in ICSME 2022

121Python, JavaJun 15, 20224 years agoApache-2.0

Similar Papers

Cite this paper

@article{yu2022bashexplainer,
  title  = {BashExplainer: Retrieval-Augmented Bash Code Comment Generation based on Fine-tuned CodeBERT},
  author = {Chi Yu and Guang Yang and Xiang Chen and Ke Liu and Yanlin Zhou},
  year   = {2022},
  eprint = {2206.13325},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2206.13325}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2206.13325.svg)](https://codeofpaper.com/paper/2206.13325)

Discussion