6

I have borrowed some lines of code (suppose just 20 lines of a function) from a GitHub repository that is licensed under the MIT License. I plan to use these lines in my personal project.

Is it sufficient to add a comment in my code with the original author's name and the license (like this: //This function borrowed from [Github Repository Address] by [Author Name], licensed under MIT) instead of adding their name directly to my project's LICENSE file? Can we add a list in NOTICE.md instead of LICENSE? I have seen some people add a header with title # Attributions in Readme.md file for listing copyright.

Consider it is just a piece of code and I'm going to specify exactly which parts or lines or which files I borrowed. What is the best practice for identifying and attributing which parts of the code are authored by someone else?

1 Answer 1

10

The MIT license is only three paragraphs long. One of them says:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

That's what you have to do if you are "borrowing" (by which you really mean "creating a derivative work of") MIT code, you don't get the choice to make up your own form of attribution.

3
  • 7
    To add: The MIT license text and copyright notices can be placed in the file(s) containing the copied code (in a place where it would be logical to look when looking for such stuff). It is not a requirement to add it to the project's LICENSE file. Commented Dec 2 at 8:13
  • 1
    What does "substantial" mean, though? Commented Dec 2 at 23:59
  • @htmlcoderexe That's pretty subjective. I don't think there are any rulings on it. I'd say, it probably depends on some intersection of "how much code is borrowed" and "how important the code that you take is."
    – Jax
    Commented Dec 4 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.