研究代码警告移除对复杂度和缺陷率的影响,发现有效移除可降低5.5%的出错概率。
Which Alert Removals are Beneficial?
- 通过随机试验与自然事件分析,识别出能降低代码复杂度的警告移除方法。
- 33%的Python文件涉及此类干预,可使未来缺陷率降低5.5个百分点。
- 为因果研究提供可复用的评估框架,适合关注代码质量与维护的研究者。
背景:静态分析能捕获软件工程知识,并报告可能存在问题的代码模式。已有研究表明这些警告对各类问题具有预测能力。然而,移除警告的实际影响尚不明确。目标:评估警告移除对代码复杂度及缺陷倾向的影响。方法:采用三种互补方法:1. 开展随机对照试验,构建包含521次人工警告移除的干预数据集;2. 使用标注函数分析代码提交中的类干预事件,识别自然发生的干预行为并评估其对缺陷倾向的影响;3. 构建包含8,245次警告移除的大规模数据集(超过人工干预数据集的15倍),应用监督学习预测移除对缺陷倾向的影响。结果:识别出可降低复杂度且减少未来缺陷的干预措施,此类干预适用于33%的Python文件,可能使缺陷倾向降低5.5个百分点。结论:提出了评估干预影响的方法,可识别大量亟需的自然干预,为多领域因果研究提供支持。
原文摘要 · Abstract (English)
Context: Static analysis captures software engineering knowledge and alerts on possibly problematic patterns. Previous work showed that they indeed have predictive power for various problems. However, the impact of removing the alerts is unclear. Aim: We would like to evaluate the impact of alert removals on code complexity and the tendency to bugs. Method: We evaluate the impact of removing alerts using three complementary methods. 1. We conducted a randomized controlled trial and built a dataset of 521 manual alert-removing interventions 2. We profiled intervention-like events using labeling functions. We applied these labeling functions to code commits, found intervention-like natural events, and used them to analyze the impact on the tendency to bugs. 3. We built a dataset of 8,245 alert removals, more than 15 times larger than our dataset of manual interventions. We applied supervised learning to the alert removals, aiming to predict their impact on the tendency to bugs. Results: We identified complexity-reducing interventions that reduce the probability of future bugs. Such interventions are relevant to 33\% of Python files and might reduce the tendency to bugs by 5.5 percentage points. Conclusions: We presented methods to evaluate the impact of interventions. The methods can identify a large number of natural interventions that are highly needed in causality research in many domains.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。