-9

I got the following error message:

Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut.

Stack Overflow's program that detects code works pretty well, but it is not perfect. There was a question I tried to post and was not allowed to, due to the filter thinking some text was code when it really wasn't. All of my actual code was indented.

I hope that a future feature might be to display the "post contains code that is not formatted" as a warning but allows users to override it and submit something anyway. Maybe the user can choose "yes" from some sort of "Are you sure you want to post this?" kind of dialogue.

This will increase the number of questions containing unintended code, but I think that's preferable from preventing users from posting carefully written legitimate questions. Also, one can ameliorate the damage by requiring a minimum number of reputation points to override warnings. Generally, only new users won't format their code properly.

11
  • 5
    Do you have any examples that support your case? From what you're describing, that's a single false positive in a sea, and a single false-positive does not a case make.
    – Daedalus
    Commented Oct 26, 2017 at 5:36
  • Is the format check only applied to text inside code blocks? If not, then I would say that's a bug. Commented Oct 26, 2017 at 8:32
  • Removing such checks will allow more badly-formatted/indented code to be posted. Those posts will be downvoted, close-voted as 'Unclear' and deleted. The uses will get Q. banned. If a filter can help improve badly-formatted questions before they are posted, then fewer new users will get banned, less user-mod time and votes wil be wasted on closing unclear questions. Commented Oct 26, 2017 at 8:36
  • Better to link to the question where you encountered a false-positive so the heuristic can be improved, rather than turn it off altogether.
    – Cody Gray Mod
    Commented Oct 26, 2017 at 9:34
  • 2
    @CodyGray They can't post the question (and so can't link anyone to it). That's the whole point here. They'd need to do something different, like provide the markdown for their draft in the meta question, or something along those lines.
    – Servy
    Commented Oct 26, 2017 at 13:40
  • 3
    @Martin James There are two sides to the issue. Not enforcing the website's heuristic for what it thinks is code would, as you say, allow more badly-formatted code to be posted. However, you ignored the fact that enforcing the website's check on properly formatted code also sometimes prevents legitimate postings from going up. Also, I do not think that the increase in poorly-formatted code would be as significant as you say. You ignored my suggestion that the heuristic be enforced on low reputation users, but that high reputation users be allowed to bypass it. Commented Oct 26, 2017 at 15:34
  • 1
    I ran into this problem today. I ended up adding random starting spaces to by block quote to trick it into seeing my quote as a quote instead of code.
    – Eph
    Commented Jul 30, 2020 at 21:06
  • i had the same problem today, i didn't have any code at all in the answer and the only text that could look like code was a name of a class with a dot at the end, that was inside a link, i'm sure that for one person raising the problem in a stackoverflow-meta question, there are loads of other people that gets the error but don't actually care to raise the problem
    – Sambuccid
    Commented Mar 3, 2021 at 8:49
  • this is an example of an answer with the problem stackoverflow.com/a/62645435/8308815
    – Sambuccid
    Commented Mar 3, 2021 at 8:52
  • another example (for @Daedalus) meta.stackoverflow.com/questions/251183/…
    – There
    Commented May 13, 2022 at 4:09
  • @There What do you expect me to do with this information?
    – Daedalus
    Commented May 13, 2022 at 4:35

1 Answer 1

7

The problem with any "Are you sure" dialog is that we have been trained, conditioned, and are absolute experts in completely ignoring whatever message it was intended to share, and simply skipping it to pacify our workflow and timeline.

I don't see this being of any lasting benefit. Those of us with sufficient reputation seldom see this warning anyway, and those who do are often those with less rep. We'd realistically accomplish nothing by implementing this.

You must log in to answer this question.

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