paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Copilot-in-the-Loop: Fixing Code Smells in Copilot-Generated Python Code using Copilot

Copilot 在环:使用 Copilot 修复 Copilot 生成的 Python 代码中的代码坏味
ASE Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering2024匹配度 3/10 · 该论文关注 Copilot 生成 Python 代码的代码坏味及用 Copilot Chat 修复的效果,属于 LLM 生成代码质量与提示词评估,而非静态分析、形式化验证、浮点程序分析或贝叶斯程序分析;虽然涉及 LLM 生成代码这一场景,但核心是 LLM 工具自身修复能力,与用户追的核心问题(将静态分析应用于 ML/Agentic 程序、用 LLM 改进静态分析)不匹配。引用 15 inbox
Beiqi Zhang, Peng Liang, Qiong Feng, Yujia Fu, Zengyang Li
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:构建 Copilot 生成 Python 代码的代码坏味数据集,并评估 Copilot Chat 在不同提示下修复坏味的效果。

Python 中代码坏味会降低可读性与可维护性,而 GitHub Copilot 等大模型代码生成工具生成的代码也可能包含坏味。本文构建了包含 102 个代码坏味的 Copilot 生成 Python 代码数据集,首先探究坏味的出现情况,再评估 Copilot Chat 在不同提示(prompt)下修复这些坏味的效果。结果表明,10 类代码坏味中有 8 类可在 Copilot 生成的 Python 代码中检出,其中多层嵌套容器(Multiply-Nested Container)最为常见;Copilot Chat 的最高修复率达 87.1%,显示出修复自身生成代码坏味的潜力,并且提供更详细的提示可以进一步提升修复效果。

问题
Copilot 生成的 Python 代码中存在哪些代码坏味、分布如何尚不清楚,且交互式工具 Copilot Chat 能否有效修复这些坏味也缺乏评估。
方法
构建含 102 个代码坏味的 Copilot 生成 Python 代码数据集,使用不同详细程度的提示驱动 Copilot Chat 进行修复,并比较其效果。
评估
统计 10 类代码坏味在数据集中的出现情况,测量 Copilot Chat 在不同提示下的修复率(最高 87.1%),并分析提示详细程度对修复效果的影响。
原文摘要(Abstract)

As one of the most popular dynamic languages, Python experiences a decrease in readability and maintainability when code smells are present. Recent advancements in Large Language Models have sparked growing interest in AI-enabled tools for both code generation and refactoring. GitHub Copilot is one such tool that has gained widespread usage. Copilot Chat, released in September 2023, functions as an interactive tool aimed at facilitating natural language-powered coding. However, limited attention has been given to understanding code smells in Copilot-generated Python code and Copilot Chat’s ability to fix the code smells. To this end, we built a dataset comprising 102 code smells in Copilot-generated Python code. Our aim is to first explore the occurrence of code smells in Copilot-generated Python code and then evaluate the effectiveness of Copilot Chat in fixing these code smells employing different prompts. The results show that 8 out of 10 types of code smells can be detected in Copilot-generated Python code, among which Multiply-Nested Container is the most common one. For these code smells, Copilot Chat achieves a highest fixing rate of 87.1%, showing promise in fixing Python code smells generated by Copilot itself. In addition, the effectiveness of Copilot Chat in fixing these smells can be improved by providing more detailed prompts.CCS CONCEPTS• Software and its engineering → Software maintenance tools.

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{Zhang0FFL24,
  title = {Copilot-in-the-Loop: Fixing Code Smells in Copilot-Generated Python Code using Copilot},
  author = {Beiqi Zhang and Peng Liang and Qiong Feng and Yujia Fu and Zengyang Li},
  booktitle = {ASE},
  year = {2024},
  doi = {10.1145/3691620.3695290}
}