Code Smell-guided Prompting for LLM-based Defect Prediction in Ansible Scripts
Ensuring the reliability of infrastructure as code (IaC) scripts, like those written in Ansible, is vital for maintaining the performance and security of edge-cloud systems. However, the scale and complexity of these scripts make exhaustive testing impractical. To address this, we propose a large language model (LLM)-based software defect prediction (SDP) approach that uses code-smell-guided prompting (CSP). In some cases, CSP enhances LLM performance in defect prediction by embedding specific code smell indicators directly into the prompts. We explore various prompting strategies, including zero-shot, one-shot, and chain of thought CSP (CoT-CSP), to evaluate how code smell information can improve defect detection. Unlike traditional prompting, CSP uniquely leverages code context to guide LLMs in identifying defect-prone code segments. Experimental results reveal that while zero-shot prompting achieves high baseline performance, CSP variants provide nuanced insights into the role of code smells in improving SDP. This study represents exploration of LLMs for defect prediction in Ansible scripts, offering a new perspective on enhancing software quality in edge-cloud deployments.
Authors
- Sungu Lee
- Jongmoon Baik (ORCID: https://orcid.org/0000-0002-2546-7665)
- Hyunsun Hong
- Duksan Ryu (ORCID: https://orcid.org/0000-0002-9556-0873)
Institutions
- Korea Advanced Institute of Science and Technology (KR)
- Jeonbuk National University (KR)
Publication Details
- Journal
- Journal of Web Engineering
- Published
- 2025-02-07
- DOI
- https://doi.org/10.13052/jwe1540-9589.2383
- Citations
- 1
- Primary Topic
- Software Engineering Research
- Type
- article
- Field-Weighted Citation Impact
- 3.25