If the user that posted the question deletes the code to which the question belongs to, after accepting an answer, should one restore the code or simply notify the user or moderator?


2 Answers 2


If the user has decided they don't want the code listed on the site, I think we need to delete the question. Asking for code review on code you don't want people to see is well silly, but it happens somehow. In this case, the user asked for the question to be removed so I did. I think we have to respect the poster's desire not show their code.

So: You should flag questions which have code removed, and the mods should delete them.

  • 11
    \$\begingroup\$ Is this really the best way to go? Anyone who has posted an answer that got accepted is going to lose reputation points if you delete the question. Also if the poster didn't want their code to be here he/she shouldn't have posted the code/question at all. \$\endgroup\$
    – user555
    Commented Nov 13, 2012 at 1:14
  • 4
    \$\begingroup\$ @user555, admittedly its not great. The user should never have posted the question, but it's too late for that. The only solution I see is to delete the question. \$\endgroup\$ Commented Nov 13, 2012 at 4:09
  • 14
    \$\begingroup\$ Posts on all SE sites are licensed CC BY-SA. I don't believe we are under any obligation to remove code just because the original author doesn't want it to be here anymore. \$\endgroup\$
    – Matt
    Commented Nov 14, 2012 at 15:00
  • 5
    \$\begingroup\$ @Matt We don't have obligation to do that, but we should also be nice to people. And if someone says that they made a mistake by posting their code (because it's confidential, or something like that), I think it wouldn't be nice to insist on keeping that code. \$\endgroup\$
    – svick
    Commented Nov 15, 2012 at 7:38
  • 2
    \$\begingroup\$ I think the reason for wanting it to be deleted should be taken into account, but unfortunately people can lie. \$\endgroup\$
    – crdx
    Commented Nov 16, 2012 at 19:29
  • \$\begingroup\$ If the question is well-received by the community, has merit, and contains no sensitive information (including such code), the OP can still request disassociation from the question. Otherwise, the CC license remains in effect here. \$\endgroup\$
    – Jamal
    Commented Jan 6, 2014 at 20:11

Deleting code from a question after it received answers is certainly not acceptable behavior. If the code in question was sensitive or something like that, the poster can delete the whole question.

Code Review is different from other SE sites in that pretty much every “question” here is “too localized”: it's not likely that someone else will have exactly the same question. But that doesn't mean we should make our answered questions even less useful for others.

I think restoring the code is the right way to go here, so I did just that. If something like that happens in the future again, feel free to restore the code yourself. And since you don't have the reputation required for non-reviewed editing, your edit will be reviewed by someone else anyway.


You must log in to answer this question.

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