Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I have seen a lot people carelessly pasting mountains of code with their question. They usually paste n lines of code when only one line is required. Somebody who tries to answer this question has to spend more time digging up the code to find the point of problem.

Also I saw instances where people post code that is not related to their question. Some posters paste a lot of hex data which is not required for question and ask questions like "how can I convert a jpeg image to an array like this in python?"

There are even cases where there is a lot of code but no valid question.

In my short journey with SO this was the most common and single annoyance I have found and that is the reason I have decided to ask here.

IMHO this happens mostly because some people are too lazy to ask question in a proper/formal way, not because any kind of ignorance.

Is there any regulation(like rule based filtering) exists for this?

share|improve this question
Regulation? How do you mean? Do you mean if there are required standards? – Oded Feb 4 '13 at 12:20
@Oded congrats for your new role! Still can't see you in the team page though... :) – Shadow Wizard Feb 4 '13 at 12:24
Better than no code at all... sometimes these folks have no clue which parts of their code are relevant to the question, so they paste all of it in case it's relevant. – Wesley Murch Feb 4 '13 at 12:24
No regulation. The answer to this question is also relevant in this case though. – Shadow Wizard Feb 4 '13 at 12:29
@ShaWizDowArd - Toda... Give it time - only started last Monday – Oded Feb 4 '13 at 12:30
offtopic: Looks like so found another(@Oded) good moderator and developer.. congrats – NullPoiиteя Feb 4 '13 at 14:27
@ShaWizDowArd I'm glad I'm not the only one who did a double take when that diamond showed up. – mikeTheLiar Feb 4 '13 at 15:08
@mike yeah, I used to see Oded all around and the diamond is a nice addition. :) – Shadow Wizard Feb 4 '13 at 15:24
up vote 6 down vote accepted

Posting too much code, if it's an excessive amount, is indicative of someone who didn't put as much time and effort into their question as they should have. It often means they skipped debugging their own program, or didn't spend as much time as they should have. It usually means that the text of the post will fail to demonstrate the expected research that should be done before asking such a question. In cases such as this, it's appropriate to downvote the question for the lack of effort and optionally comment indicating how the user can improve it and why it is not a good quality question.

Sometimes there are users that just feel that it's better to risk including code that isn't needed than to miss code that is, and so just include more code than they should on an otherwise high quality question simply because they didn't know what was relevant and wanted to ensure there wouldn't need to be requests for more code. If you feel that the question is generally of high quality, that the user put an appropriate amount of time and effort into it, but just happened to include more code than is needed, then a downvote shouldn't be needed. It is sufficient to comment on the question stating which sections of code are relevant and which are not. You should be careful about editing any of the code out of the question though. You should be very sure that it's not needed before doing so (i.e. wait until it's already been answered).

share|improve this answer

The only thing you can do is politely ask the OP to reduce the amount of code they post to the minimum amount that reproduces the problem.

You never know, they might solve the problem themselves in the process.

share|improve this answer

This is where the forum "self-moderating" concept takes role - you can sugest edits to the post or you can flag the post for a moderator.
Whole thing cannot be automated, because even if bots succesfull rate would be 90%, bots would mark too many posts for no reason.

share|improve this answer
It's not a good idea to remove code from posts, no matter the reason. It might end up being important. I will personally roll back any such edit when I encounter it. Like Chris already said, you can ask the OP to focus on the problem and post relevant code, but it's really up to him. – Shadow Wizard Feb 4 '13 at 13:17
This is why i said "suggest" edit, because nothing should be deleted based on opinion of an individual.What would be good idea is posibility to open big codes in new browser tab. – Tomáš Zato Feb 4 '13 at 13:30
@TomášZato No, it's not appropriate to suggest and edit such as this; it should be rejected under almost all circumstances. Also note the content isn't really deleted, it's still in the revision history. – Servy Feb 4 '13 at 17:43
On a handful of questions, which were unwieldy in breadth AND where there was one particular problem outstanding AND where my domain expertise gave me a clear and certain understanding of that one problem, I have removed extraneous code and prose, suggesting that the asker post a follow-up question, to try to avoid closure. (It also helps if the one problem has already been addressed by an answer.) It's inappropriate in 99.8% of cases, however, and flagging would be completely unhelpful, because the moderator who handles the flag may very well not have the expert knowledge required to edit. – Josh Caswell Feb 4 '13 at 19:48

You must log in to answer this question.

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