一句话:构建 Chrome 扩展 ExampleCheck,利用 GitHub 挖掘的 API 使用模式检测并解释 Stack Overflow 代码片段的 API 误用。
程序员常通过 Stack Overflow 学习新 API,但其中的代码片段未必完整或可靠。该论文提出 ExampleCheck:一个 Chrome 扩展,从 38 万个 GitHub 项目中挖掘常见 API 使用模式,并用这些模式检测 Stack Overflow 帖子里的 API 使用违规。它进一步量化给定片段与 GitHub 常见用法的一致程度,并展示如何修复检测到的违规。通过该工具,程序员可以识别 Stack Overflow 片段的陷阱,了解其偏离主流 API 使用模式的程度。
Programmers often consult Q&A websites such as Stack Overflow (SO) to learn new APIs. However, online code snippets are not always complete or reliable in terms of API usage. To assess online code snippets, we build a Chrome extension, ExampleCheck that detects API usage violations in SO posts using API usage patterns mined from 380K GitHub projects. It quantifies how many GitHub examples follow common API usage and illustrates how to remedy the detected violation in a given SO snippet. With ExampleCheck, programmers can easily identify the pitfalls of a given SO snippet and learn how much it deviates from common API usage patterns in GitHub. The demo video is at https://youtu.be/WOnN-wQZsH0.