arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1909.06251cs.SE
收藏

V2:Python中配置漂移的快速检测

V2: Fast Detection of Configuration Drift in Python

Eric Horton, Chris Parnin

摘要:

代码片段很普遍,但很难重用,因为它们通常缺乏相应的环境配置。大多数都不是主动维护的,随着时间的推移,代码片段会过时,从而导致最新可能的配置和代码片段之间出现漂移。最近的工作已经将验证和检测过期代码片段的问题确定为代码重用的最重要考虑因素。然而,确定一个片段是否正确,但只是过时,是一个不平凡的任务。在最好的情况下,破坏性的更改都有很好的文档记录,允许开发人员手动确定代码段何时包含过时的API用法。在最坏的情况下,确定是否以及何时进行了破坏性更改需要对以前的依赖项版本进行详尽的搜索。我们提出了V2,这是一种通过检测配置漂移的离散实例来确定代码片段是否过时的策略,其中代码片段使用的API已经发生了重大变化。配置漂移的每个实例根据验证期间遇到的故障和配置补丁进行分类,配置补丁由依赖版本更改组成,用于修复底层故障。V2使用反馈导向搜索来探索代码片段的可能配置空间,减少了需要验证的潜在环境配置的数量。当运行在之前研究的公共Python片段语料库上时,V2识别出248个配置漂移实例。

英文摘要:

Code snippets are prevalent, but are hard to reuse because they often lack an accompanying environment configuration. Most are not actively maintained, allowing for drift between the most recent possible configuration and the code snippet as the snippet becomes out-of-date over time. Recent work has identified the problem of validating and detecting out-of-date code snippets as the most important consideration for code reuse. However, determining if a snippet is correct, but simply out-of-date, is a non-trivial task. In the best case, breaking changes are well documented, allowing developers to manually determine when a code snippet contains an out-of-date API usage. In the worst case, determining if and when a breaking change was made requires an exhaustive search through previous dependency versions. We present V2, a strategy for determining if a code snippet is out-of-date by detecting discrete instances of configuration drift, where the snippet uses an API which has since undergone a breaking change. Each instance of configuration drift is classified by a failure encountered during validation and a configuration patch, consisting of dependency version changes, which fixes the underlying fault. V2 uses feedback-directed search to explore the possible configuration space for a code snippet, reducing the number of potential environment configurations that need to be validated. When run on a corpus of public Python snippets from prior research, V2 identifies 248 instances of configuration drift.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑