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

Toxic Code Snippets on堆栈溢出

Toxic Code Snippets on Stack Overflow

Chaiyong Ragkhitwetsagul, Jens Krinke, Matheus Paixao, Giuseppe Bianco, Rocco Oliveto

摘要:

在线代码克隆是从软件项目或在线源复制到Stack Overflow的代码片段。由于在将代码复制到Stack Overflow后缺乏检查机制,它们可能成为有毒代码片段,例如,它们遭受过时或违反原始软件许可证的问题。我们提出了一个在线代码克隆的研究堆栈溢出和它们的毒性,结合两个开发人员的调查和大规模的代码克隆检测。一项针对201名高知名度Stack Overflow回答者(33%的回复率)的调查显示,131名参与者(65%)曾经被告知过时的代码,其中26名(20%)很少或从未修复过代码。138名受访者(69%)从不检查他们复制的代码片段与Stack Overflow的CC BY-SA 3.0之间的许可冲突。对87位Stack Overflow访问者的调查显示,他们在Stack Overflow的回答中遇到了几个问题:不匹配的解决方案,过时的解决方案,不正确的解决方案和错误的代码。85%的人不知道Stack Overflow强制执行的CC BY-SA 3.0许可证,66%的人在重用代码片段时从不检查许可证冲突。我们的克隆检测发现了Stack Overflow上的72,365个Java代码片段和Qualitas语料库中的111个开源项目之间的在线克隆对。我们分析了2,289个非平凡的在线克隆候选人。我们的调查显示,有强有力的证据表明,153个克隆已经从Qualitas项目复制到Stack Overflow。我们发现其中100个(66%)是过时的,其中10个是错误的,有害的重复使用。此外,我们还发现了214个可能违反原始软件许可证的代码片段,在2,427个GitHub项目中出现了7,112次。

英文摘要:

Online code clones are code fragments that are copied from software projects or online sources to Stack Overflow as examples. Due to an absence of a checking mechanism after the code has been copied to Stack Overflow, they can become toxic code snippets, e.g., they suffer from being outdated or violating the original software license. We present a study of online code clones on Stack Overflow and their toxicity by incorporating two developer surveys and a large-scale code clone detection. A survey of 201 high-reputation Stack Overflow answerers (33% response rate) showed that 131 participants (65%) have ever been notified of outdated code and 26 of them (20%) rarely or never fix the code. 138 answerers (69%) never check for licensing conflicts between their copied code snippets and Stack Overflow's CC BY-SA 3.0. A survey of 87 Stack Overflow visitors shows that they experienced several issues from Stack Overflow answers: mismatched solutions, outdated solutions, incorrect solutions, and buggy code. 85% of them are not aware of CC BY-SA 3.0 license enforced by Stack Overflow, and 66% never check for license conflicts when reusing code snippets. Our clone detection found online clone pairs between 72,365 Java code snippets on Stack Overflow and 111 open source projects in the curated Qualitas corpus. We analysed 2,289 non-trivial online clone candidates. Our investigation revealed strong evidence that 153 clones have been copied from a Qualitas project to Stack Overflow. We found 100 of them (66%) to be outdated, of which 10 were buggy and harmful for reuse. Furthermore, we found 214 code snippets that could potentially violate the license of their original software and appear 7,112 times in 2,427 GitHub projects.

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

↑