Sometimes when I review edits in the Suggested Edits queue, code or text from a linked pastebin is edited into the question. Is this encouraged? Should this be approved?

| |
  • 7
    Does it improve the post? Was the code from a link the OP provided? If yes to both I see no problem. – NathanOliver Dec 12 '16 at 19:04
  • 1
    If Pastebin contains nothing but code barf, don't edit it – Machavity Dec 12 '16 at 21:35
  • 8
    I personally ignore questions which require looking at another site (any other site). – Not loved Dec 13 '16 at 1:54
  • No. If the question is not complete and self-contained as written, then it should be closed. Because of licensing issues and a lack of an MCVE, only the person who originally asked the question can reasonably be expected to add code. – Cody Gray Dec 13 '16 at 10:25

In general, yes. Questions should be self-contained, i.e. all information must be in the question itself and not depend on external links (which may break).

There are exceptions, though. If the pastebin is 1000 lines long, the question doesn't become any clearer just by pasting the code itself; the OP needs to provide an MCVE, not just a code dump. Another exception would be a case like this:

Can you please fix my code?


in which, even with code, it is unclear what the OP is asking.

| |
  • 2
    Why shouldn't the code in your last example be edited in? Is it because the question is so bad that you shouldn't even waste time editing it in and the question should just be closed? – Kodos Johnson Dec 12 '16 at 19:27
  • 11
    @KodosJohnson Glorfindel's answer mentions this: because the pastebin's code is not an MCVE. Don't edit code dumps into a question; that responsibility belongs to the OP, who must determine what code is relevant and what code is extraneous. – TylerH Dec 12 '16 at 19:29
  • 13
    There's a bigger concern here, though, and that's that the license for pastebin might not be the same as the license for SO. It really might not be OK to copy code from pastebin to SO if it's not your code. I've written about this in this answer to another question, for instance. That answer says that code should be edited in, but really only by OP. It's not, in general, possible to make sure that the licensing issues are addressed by an editor, and so edits that copy code from elsewhere should be rejected in the edit queue. – Joshua Taylor Dec 12 '16 at 21:25
  • 1
    @JoshuaTaylor that's a valid concern, but 9 out of 10 times it is the OPs own code in the pastebin. Or, to make it even more complex, the OP might have copied the code from somewhere else without attribution. We honestly can't expect our editors/reviewers to check this all. Why do you think there is no rejection reason 'copied content' for question edits, while there is one for tag wiki edits? – Glorfindel Dec 12 '16 at 21:53
  • 13
    @Glorfindel It's not a question of whether it's OP's code or not; it's a question of whether OP wants it licensed under the terms that SO imposes. E.g., if OP posts code on OP's own website and links to it from SO, it can still be whatever license OP wants. If OP posts it to SO, then it's under whatever license SO imposes. It's not a question of authorship; it's a question of OP's licensing intent. I agree that it's unreasonable for edit reviewers to try to figure this out; that's why the editor should instead leave a comment asking OP to post code here, and perhaps downvote as no MVCE. – Joshua Taylor Dec 12 '16 at 22:21
  • 10
    @JoshuaTaylor Maybe you should write that as an alternative answer... – hyde Dec 12 '16 at 23:16
  • 1
    @JoshuaTaylor I feel (but YMMV) that this happens once in a million questions. Agreed, a comment would be marginally better than an edit (especially if the OP is still online), but a lot of OPs don't know (or don't want to use) the edit link. In the very rare case of an unwanted pastebin transfer, the OP can always rollback (and ask the SE team to remove the revision), and specify clearly that (s)he doesn't want the code to be on Stack Overflow. – Glorfindel Dec 13 '16 at 7:58
  • 1
    What happens more often is that OPs state that they don't want to put their code on Stack Overflow because of a confidentiality agreement, but then they won't post it on pastebin either. – Glorfindel Dec 13 '16 at 7:59
  • @hyde additional answer given – Cœur Apr 11 '17 at 16:50
  • @JoshuaTaylor and Glorfindel those are both valid points, Joshua please post your as an answer. – smci Jul 9 '19 at 2:16

To address the legal concern, Pastebin content is CC-BY-SA (it's written in the footer), so (unlike jsFiddle) yes it's legally fine to reuse Pastebin on Stack Overflow given that you attribute the author (in the edit description for instance).

To address the practice, yes editing is encouraged, as otherwise questions lacking an MCVE in the post itself would be closed and later potentially deleted.

| |
  • With the caveat that you shouldn't bother doing it if the question is otherwise horrible, especially if you don't have the rep necessary to bypass the Suggested Edit queue, since you're taking up other people's time. – Heretic Monkey Apr 11 '17 at 16:53

Not the answer you're looking for? Browse other questions tagged .