It'd certainly be a very helpful feature, which would also keep as many off-topic questions from being posted. This is a very hard task though, so I'd suggest that we just check to see if there's properly formatted code, or not, and if there isn't, then display a message like this:
It appears that your question contains no code. If you haven't formatted your code correctly, please format it correctly. If your question does contain no code, then it will considered as off-topic. Please refer to the help centerhelp center to learn what is on, and off-topic.
Or something a little more "word-smithy" along the lines of that.