I'm working on an OSS project and often ask questions about how to fix or improve my code.
I was wondering to what extent contributions made by Stack Overflow should be recorded.
Should answerers be added to the contributor list?
I'm working on an OSS project and often ask questions about how to fix or improve my code.
I was wondering to what extent contributions made by Stack Overflow should be recorded.
Should answerers be added to the contributor list?
If you rewrite the code using ideas a question/answer gave you, then it's your work, and you can do whatever you want with it.
Content on StackExchange that is written on/after March 1st, 2016 is now under an MIT license with an additional right for you:
You don’t have to include the full MIT License in your code base. Contributors agree to give code users permission to ignore the MIT License’s notice preservation requirement, as long as users give reasonable attribution upon request of the copyright holder (or Stack Exchange on behalf of the contributor). This optional exception to the MIT License will live in our terms of service.
So
To future-proof your work, [Stack Exchange] recommend[s] you do one of these 2 things, or both:
A) Add a comment to your code that links back to the post where you found it
B) Comply with the MIT as it’s typically used, by including the full license text in your source
If your project is open source with an MIT license, a compatible license (such as the GPL), a GPL compatible license
Confused by this? Just treat the code you find in Stackoverflow as if it's licensed as an MIT License (without the additional right).
You must give attribution, under the terms of the CC BY-SA 3.0 License
You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
So putting them in a contributor file might count as a "way that suggests the licensor endorses you or your use," which isn't true - you should probably write something like this:
This licensing text was created by penne12 on StackOverflow under a CC BY-SA 3.0 License, but he doesn't endorse this project in any way. You can see the answers from which I used code here:
Or something like that. You can also put a link in your source code, which might help to keep your contributor file for those actually contributing (with PRs and new features) to your project:
// Function from penne12 on Stackoverflow (https://meta.stackoverflow.com/a/311848/3144928) under a CC BY-SA 3.0 License
function doComplexStuff(number){
console.log("Doing Super Complex Stuff")
if(typeof number !== "number"){
console.error("That's not a number");
return NaN;
} else if(number == 42) {
return "correct";
} else if(number == 3.14) {
return "yum";
} else {
return "maybe"
}
}
Remember, this is only if you publish the code - if it's never given to anyone (server side code, obfuscated code, compiled code, etc), you shouldn't have to do this. You can use the code for commercial purposes.
Just make sure you
If you are putting code written by someone else that's GLP licensed on your answer/question, you normally can't use it without written permission, but there's another question about this.
I'm not a lawyer - and I'm not your lawyer either. This answer is based off of US copyright law. Reading this doesn't create any form of legal bond. The answer is provided as-is - I'm not responsible for your use.
I don't think that this is so much a legal issue; it's a moral one. Code can be copyrighted but ideas can't. If you copy an answer verbatim into your code base, then yes, you have to obey the Creative Common license. But if you're writing a project using this copy & paste approach, you'll likely get into bigger troubles than licensing issues anyway. If instead, you do your homework and boil down your questions to isolated minimal examples, you will need to transform the answer back into the context of your project. While doing so, you re-write the concept you've learned from the answer in your own “words” and subsequently become the author of it. This doesn't mean that you shouldn't give credit to the person who taught you the concept. I think a simple comment in the source code will usually be appropriate. Something along the lines of “the frobnification logic is based on an idea of J Random Hacker posted in this Stack Overflow thread [link]” or “this works around a bug in Clang as explained by somebody here [link]”. You don't have to do this in a legal sense but if you feel it is the right thing to do, it probably is. Apart from that, such a comment also has value on its own because future readers of your code may look at the answer on Stack Overflow and – unless it's merely a code dump – perhaps learn something. Don't list anybody in an “authors” file unless the person told you they want to be listed. Being listed there implies some kind of endorsement or mental affiliation with the project which you cannot assume from a person who simply answered your Stack Overflow question without even knowing about your project.
Date.parse
. Cargo cult programming is certainly a terrible idea, but the best SO answers don't allow that very well anyway.
Commented
Dec 6, 2015 at 22:47
print("Hello World");
is copyrighted.