There have been several discussions regarding code-only answers (answers that contain only code blocks with no textual explanation whatsoever):
- Down Vote "code only" answers?
- Explaining entirely code-based answers
- How to improve low quality answers consisting of only a code block?
- Delete informative code-only answers? Not!
Personally, I can't see why the quality filter should let such answers through at all. The main problem I have with code-only answers, especially once they're flagged as not an answer or very low quality, is that we can't determine at a glance whether these answers are:
- Genuinely attempting to answer the question
- FGITW/SCITE answers
- Trying to correct an error in the question without actually answering it
- Random code dumps that may or may not relate to the question even by programming language or keyword(s) in the question
In particular, what exactly is an "informative code-only answer"? Does it mean the code is self-documenting? Does it mean the code substitutes code comments for a proper write-up? This is all very fuzzy. From the response by Nicol Bolas to the last question above:
I have never seen a code-only answer that couldn't be made better with the addition of appropriate text. They are of lower-quality than the same answer with some text.
This text makes all the difference, IMO, between an answer and a non-answer. Without it, it's often needlessly difficult to tell.
Existing code-only answers that are good-faith attempts to answer the question should be edited or downvoted, yes. But if the quality filter already tries to block code-only questions, why not block code-only answers too? These answers are often low quality, and (almost) always have ample room for improvement, just like questions.