Write Your Own CodeChecker: An Automated Test-Driven Checker Development Approach with LLMs

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Liu, Jun, Xie, Yuanyuan, Yan, Jiwei, Huang, Jinhao, Yan, Jun, Zhang, Jian
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912486700089344
author Liu, Jun
Xie, Yuanyuan
Yan, Jiwei
Huang, Jinhao
Yan, Jun
Zhang, Jian
author_facet Liu, Jun
Xie, Yuanyuan
Yan, Jiwei
Huang, Jinhao
Yan, Jun
Zhang, Jian
contents With the rising demand for code quality assurance, developers are not only utilizing existing static code checkers but also seeking custom checkers to satisfy their specific needs. Nowadays, various code-checking frameworks provide extensive checker customization interfaces to meet this need. However, both the abstract checking logic and the complex API usage of large-scale checker frameworks make this task challenging. To this end, automated code checker generation is anticipated to ease the burden of checker development. In this paper, we propose AutoChecker, an innovative LLM-powered approach that can write code checkers automatically based on only a rule description and a test suite. To achieve comprehensive checking logic, AutoChecker incrementally updates the checker's logic by focusing on solving one selected case each time. To obtain precise API knowledge, during each iteration, it leverages fine-grained logic-guided API-context retrieval, where it first decomposes the checking logic into a series of sub-operations and then retrieves checker-related API-contexts for each sub-operation. For evaluation, we apply AutoChecker, five baselines, and three ablation methods using multiple LLMs to generate checkers for 20 randomly selected PMD rules. Experimental results show that AutoChecker significantly outperforms others across all effectiveness metrics, with an average test pass rate of 82.28%. Additionally, the checkers generated by AutoChecker can be successfully applied to real-world projects, matching the performance of official checkers.
format Preprint
id arxiv_https___arxiv_org_abs_2411_06796
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Write Your Own CodeChecker: An Automated Test-Driven Checker Development Approach with LLMs
Liu, Jun
Xie, Yuanyuan
Yan, Jiwei
Huang, Jinhao
Yan, Jun
Zhang, Jian
Software Engineering
With the rising demand for code quality assurance, developers are not only utilizing existing static code checkers but also seeking custom checkers to satisfy their specific needs. Nowadays, various code-checking frameworks provide extensive checker customization interfaces to meet this need. However, both the abstract checking logic and the complex API usage of large-scale checker frameworks make this task challenging. To this end, automated code checker generation is anticipated to ease the burden of checker development. In this paper, we propose AutoChecker, an innovative LLM-powered approach that can write code checkers automatically based on only a rule description and a test suite. To achieve comprehensive checking logic, AutoChecker incrementally updates the checker's logic by focusing on solving one selected case each time. To obtain precise API knowledge, during each iteration, it leverages fine-grained logic-guided API-context retrieval, where it first decomposes the checking logic into a series of sub-operations and then retrieves checker-related API-contexts for each sub-operation. For evaluation, we apply AutoChecker, five baselines, and three ablation methods using multiple LLMs to generate checkers for 20 randomly selected PMD rules. Experimental results show that AutoChecker significantly outperforms others across all effectiveness metrics, with an average test pass rate of 82.28%. Additionally, the checkers generated by AutoChecker can be successfully applied to real-world projects, matching the performance of official checkers.
title Write Your Own CodeChecker: An Automated Test-Driven Checker Development Approach with LLMs
topic Software Engineering
url https://arxiv.org/abs/2411.06796