For the author or maintainer reason, lets go to the source: Why is only my own written code on-topic?
Moral / Polite
The purpose of a code review is to provide constructive criticism. Criticism can only be constructive if given to the person who is the emotional 'owner' of the code.
[...]
This can be abused even further. We have had instances on Code Review where 'managers' have requested their employee's code is reviewed, and the outcome of the review would impact that employee's job (fired?)
– rolfl's
answer to "Why is only my own written code on-topic?"
© CC BY-SA 4.0
Section(s) removed with "[...]".
– Peilonrayz'
answer to "Can a user post code in an answer even if they don't fully understand how it works?"
© CC BY-SA 4.0
Is an answer posted to receive "constructive criticism"?
Are we going to have bad actors abuse posting other people's code as answers?
I think we can relatively safely say "no" to both.
Practical
[...]
In Code Review, as an online resource, in a Q&A format, the expectation is that the text describing the code should explain why the code does things the way it does. Code that is just dumped without an explanation is, in Code Review terms, "unclear", and is likely to be closed as "Unclear what you are asking."
If the code is not your code, you cannot answer questions about what motivated certain implementation decisions, you can only speculate. By default, it is impossible for you to describe the motivations for the code if it is not your code, and thus the question is unclear. On code review this happens often enough for there to be a special off-topic close reason to cover this situation.
– rolfl's
answer to "Why is only my own written code on-topic?"
© CC BY-SA 4.0
Section(s) removed with "[...]".
– Peilonrayz'
answer to "Can a user post code in an answer even if they don't fully understand how it works?"
© CC BY-SA 4.0
I think we can agree giving answerer's the advice "the text describing the code should explain why the code does things the way it does." With the intent we have for questions is harmful.
However "the text describing the code should explain why the code does things the way it does." rings similar to our IO rules.
What goes into an answer
Every answer must make at least one insightful observation about the code in the question. Answers that merely provide an alternate solution with no explanation or justification do not constitute valid Code Review answers and may be deleted. In addition to criticisms, pointing out good practices in the code is also a form of helpful feedback.
Answers need not cover every issue in every line of the code. Short answers are acceptable, as long as you explain your reasoning. Do not provide suggestions for improvements in a comment, even if your suggestion makes a very short answer.
– Code Review's
How do I write a good answer?
© CC BY-SA 3.0
Legal
One of the reasons for the restriction is the implied licensing terms that are part of Stack Exchange. Anything you post here is automatically ascribed to the Creative-Commons ShareAlike type licensing. See Section 6 of your terms-of-service - subsection "Subscriber Content" here on Stack Exchange.
If it is not your code, then you have no authority to give away the licensing for it.
– rolfl's
answer to "Why is only my own written code on-topic?"
© CC BY-SA 4.0
We are not lawyers so legalities are out side our remit to understand or enforce. Additionally providing legal advice is not something non-lawyers should do.
However we may want to have rules which reduce the harm potential for all users of our site.
Lets have a quick look at the licence for the code in the answer.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
– RussellDash332's
LICENSE
Has the user provided the copyright notice or the permission notice in the answer on Code Review? No.
One thing to note is because the MIT license has the owner's name and a date included in the license no single "MIT license" exists.
We can see the Arch Wiki lightly describes the situation:
License families like BSD or MIT are, strictly speaking, not a single license and each instance requires a separate license file. In license
variable refer to them using a common SPDX identifier (e.g. 'BSD-3-Clause'
or 'MIT'
), but then provide the corresponding file as if it was a custom license.
– Arch Wiki's
PKGBUILD
© GNU Free Documentation License 1.3 or later
Another common licence our users interact with is the CC BY-SA 4.0 license.
Attribution — You must give [appropriate credit1], provide a link to the license, and [indicate if changes were made2]. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- If supplied, you must provide the name of the creator and attribution parties, a copyright notice, a licence notice, a disclaimer note, and a link to the material. CC licences prior to Version 4.0 also require you to provide the title of the material if supplied, and other slight differences.
- In 4.0, you must indicate if you modified the material and retain an indication of previous modifications. In 3.0 and earlier licence versions, the indication of changes is only required if you create a derivative.
– Creative Commons's
Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
© CC BY 4.0
I have changed the hyperlinks to [name<sup>num</sup>]
and entered the pop-up text to be in an ordered list
– Peilonrayz'
answer to "Acknowledging code review contributions in academic projects"
© CC BY 4.0
So overall the only site policy we may need is one around having a minimum level of attribution. Irrespective of actual legalities of the license of the attributed work.