What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 149 Stack Exchange communities.

Very frequently new users will respond to your answer with a comment containing a gigantic unreadable block of code that clarifies some detail. This code should ideally be edited into the original question.

I think it would be a good idea to display a notice suggesting that code be edited into the question if all of the following are true:

  1. The person leaving the comment is the owner of the question
  2. Code in the comment exceeds a reasonable number of characters
  3. (Optional) The user's rep is under a certain threshhold

Since there seems to be some confusion, please note that this measure would not somehow outlaw all code snippets in comments. It only applies to unreadably long code snippets.

In fact, it doesn't even ban the code snippets it is targeting, since the notice will be dismissable. All this does is inform the commenter about the correct place to post their code, so other users don't have to.

Suggestions/improvements welcome.

EDIT: Since people seem to agree with the idea I am going to upgrade this to a feature request.

Here are some occurrences of the problem:

I will add more as I find them.

share|improve this question
Rule of thumb: users, especially new, do not read notices. Period. No matter how many you will put in front of their eyes and how big, they will just keep ignoring them. So even though this suggestion is good, I can assume for almost 100% of certainty that it won't help in the end of the day. Comments from actual users get more attention, so in my opinion there's no choice but keep nagging such users with comments. –  Shadow Wizard Nov 25 '12 at 11:05
@ShadowWizard So you are saying that I also shouldn't add moderation comments like "Please add the code to your question by editing it"? They'll notice the downvote though... –  oberlies Jun 5 '14 at 12:07

1 Answer 1

Add a comment to the question, to the effect of "Please don't put code in comments; it is impossible to read. Edit the code into your question instead."

If the code in the comments seems reasonably complete, and you have editing rights, you can help the OP out by editing the code into the question yourself, and flagging for comments removal.

In other words, it's a little more complicated than just putting up a notice.

Folks put code in comments pretty often, and it works, provided the code is kept very, very short. I'd hate to have to see this warning every time I notified a poster of a minor error in their code by noting the correction in a comment, and I prefer doing that than correcting the poster's code myself.

share|improve this answer
You seem to have missed the requirements that the code be over a certain number of characters, and that the commenter be the owner of the question. If you have a contiguous block of code over 200 characters long there is a problem, and a dismissable notice will not be out of place. Minor corrections to a posters code would not trigger warnings. –  Asad Nov 24 '12 at 9:18
@Asad: For a new feature to justify the cost of its implementation, it needs to be something that solves a significant problem that is broadly applicable to the community. I don't think this feature meets that bar. Just leave your own comment explaining the problem. –  Robert Harvey Nov 24 '12 at 19:45
The issue I have with commenting is that it generates its own noise. First you have to leave a comment with an explanation, then you have to flag the asker's comment, then you have to edit the question with the code from the comment, then when the OP's comment is removed remove your own. Why not prevent all of this hassle? Do you feel I would have a stronger case if I were to provide several examples of this happening from the past few days? –  Asad Nov 24 '12 at 20:01
This is a really necessary feature. –  rob.alarcon Dec 19 '12 at 19:13

You must log in to answer this question.

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