Detecting Argument-Swap Bugs Using Context-Enhanced Code Representations

📅 2026-09-15
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
本文提出了一种名为BugProbe的学习方法,通过结合上下文信息和基于名称的相似性来检测Python方法调用中参数顺序错误的问题,无需依赖于调用到定义的映射。
📝 Abstract
Names of source code elements convey rich semantic information and have been widely used in software engineering tasks such as bug detection, code completion, type prediction, and code classification. Prior studies exploit lexical similarity between method arguments and formal parameter names to detect bugs caused by incorrectly ordered arguments, typically relying on establishing mappings between method calls and their corresponding definitions. However, such mappings are often difficult to obtain in dynamically typed languages like Python. In this paper, we present BugProbe, a learning-based approach for detecting incorrectly ordered arguments in Python method calls that does not require call-to-definition mappings. Our approach leverages multiple sources of contextual information, including local context and argument usage context, and combines name-based similarity with machine learning to construct expressive representations of method arguments. We collect a new dataset of 132,739 Python source files from the top-1,000 starred GitHub repositories, yielding 3,371,244 synthetic training examples, and contribute a curated benchmark of 55 real-world argument-swap bugs manually verified from commit histories. We evaluate our approach on this dataset and show that it achieves high accuracy and consistently outperforms a state-of-the-art baseline across standard evaluation metrics. These results demonstrate that effective detection of argument-ordering bugs is possible without relying on explicit call-to-definition resolution, making the approach well suited for dynamically typed language settings.
Problem

Research questions and friction points this paper is trying to address.

Argument-Swap Bugs
Dynamically Typed Languages
Python
Bug Detection
Call-to-Definition Mappings
Innovation

Methods, ideas, or system contributions that make the work stand out.

context-enhanced code representations
argument-swap bugs detection
learning-based approach
dynamically typed languages
🔎 Similar Papers
No similar papers found.