I don't see much discussion here of linters except one comment. 99% of the maybe-a-typo-maybe-a-syntax-error problems could be discovered via a simple lint. Certainly =
vs. ==
would be. Probably 50% or more of them could be solved by opening the console and looking at the errors. Whatever problems remained of the simple-logical-error-brain-fart variety could be easily resolved by some trivial debugging.
I've added comments to dozens if not hundreds of posts reminding people they could lint, or look at the console, or debug. So have others. No small number respond saying they hadn't heard of those things. It's getting really old.
The bottom line is that the vast majority of low-rep users asking lame questions apparently have never bothered to educate themselves about how to open the console or simple debugging approaches and tools, much less use a linter.
I'm tempted to write a canonical question/answer titled "My program doesn't work, and I think it might be a typo; how can I find it?", and then close questions as a duplicate of that, but that's perilously close to an abuse of the duplicate reason.
So here is the 1,291th proposal fixing or adding close reasons:
Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example. In addition, only questions where the code has already been verified by linting tools for the language in question, syntax errors already found and resolved, and appropriate debugging techniques used to try to find the problem are allowed.
Or if we want to expand the "typo" reason instead:
This question was caused by a problem that can no longer be reproduced or a simple typographical, syntax, or logical error, that could have easily been identified using a linting tool for the language in question, viewing and/or properly interpreting error output from compilers, interpreters, and run-time environments, or using basic debugging techniques. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting.
(The word "simple" here is meant to modify all three types of errors: typographical, syntax, and logical.)
Or something like that, you get the idea.
So why do suggestions like this, which are definitely nothing new, get only limited traction? It seems to be that there's a built-in conservative (i.e., do nothing) bias. For any given proposal, up pop folks constructing elaborate scenarios in which some poor, well-meaning noobie's question is cruelly squashed by some nefarious, malicious high-rep user. Most of these counterarguments boil down to a lack of trust in people who in some cases have spent hundreds, or more likely thousands, of hours on the site over a period of years. But this is not the criminal justice system: our criteria is not to prefer a hundred bad guys go free rather than a single good guy being falsely imprisoned. The whole point is to not let the bad guys--I am referring to the purveyors of mass pollution on the site in the form of low-quality questions and answers--go free, even if it does mean that one "innocent" is affected. We already know some of the tools to use to mitigate these kinds of risks, such as time-limited or tag-limited experiments. Let's use them more aggressively in pursuit of creatively addressing these issues.
if
statements.=
and==
, which appear in many more irrelevant questions and answers?for (...);
-- the;
after the header makes this a loop with an empty body.if ($row = $db->fetch())
. But in all the cases where we would close it as a dup, it's because they really meant to test for equality instead of assignment. That's why the question should be worded in terms ofif
statements not working.