You should find the most pressing issues and comment on them. Do not clean their code for them, but show examples to illustrate your points.
Code is never "too bad" to review. As long as the code is working, has a minimum standard of formatting and otherwise is on topic, it can receive a valuable review. Remember that a review does not need to improve all aspects of the code. While perfection is indeed the goal, Rome wasn't built in one day.
You should give helpful, generic tips on how to improve the code on the most pressing matters. Demonstrate what you mean by showing concrete examples from the code that has been posted. Post rules of thumb and guidelines where possible and appropriate, because users with horrible code are likely to be at or near the novice level of the Dreyfus model. Finally, encourage the poster to make a new post with the improved code, so that you can comment on and review the rest. Iterate this process as necessary.
Feel free to recommend more studying and reading. Stating "You should read more about [topic]" is sometimes the best advice. In these cases, try to be as specific as you can about which topic they should read up on. Recommending good reading material is often helpful.
There are many reasons why you should do this:
- The poster is not overwhelmed and demotivated by all the problems with the code.
- You will implicitly convey what the most important issues are.
- By giving piecemeal reviews, the chances of the poster remembering what you have pointed out are greater.
- You don't have to torment yourself with detail-reading horrible code.
- Answers that are not massive walls of text are, in my opinion, more useful to other readers.