arrow
Return

Toxic Code Snippets on Stack Overflow

delete2021-03-01
delete62
delete
OA
AI
C
Chaiyong Ragkhitwetsagul *
J
Jens Krinke
M
Matheus Paixão
G
Giuseppe Bianco
R
Rocco Oliveto
DOI:10.1109/TSE.2019.2900307delete
deleteOriginal
deleteShare
deleteSave
View PDF
Abstract

Abstract

En 中文
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 percent response rate) showed that 131 participants (65 percent) have ever been notified of outdated code and 26 of them (20 percent) rarely or never fix the code. 138 answerers (69 percent) 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 percent of them are not aware of CC BY-SA 3.0 license enforced by Stack Overflow, and 66 percent 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 percent) 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.
Keywords:
Cloning
Licenses
Software
Programming
Computer bugs
Security
Tutorials
Code clone detection
stack overflow
outdated code
software licensing
AI Summary

AI Summary

Key information extracted from the uploaded paper, including a brief overview, abstract, background, key highlights, visual analysis, and future outlook.

Journal

IEEE Transactions on Software Engineering cover
IEEE Transactions on Software Engineering
IF:
5.6
Papers:
2.8K
Citations:
1.1W

Organization

U
University of Molise
Scholars:
2.6K
Papers: 2.6K
Citations: 2.8K
U
University College London
Scholars:
7.9W
Papers: 6.2W
Citations: 15.7W
U
university of london
Scholars:
21.5W
Papers: 19.7W
Citations: 305
U
universidade estadual do ceara
Scholars:
1.6K
Papers: 897
Citations: 2
M
mahidol university
Scholars:
2.3W
Papers: 1.5W
Citations: 19
researcher View more organizations