As you gain experience on Stack Overflow you'll begin to recognize what kinds of questions can be helped by editing, and what ones only the OP can salvage.
If a question needs more information, just cleaning up the code formatting won't help to make it more answerable. (Indeed, with some programming languages the faulty code formatting could be the reason for the problem, meaning you'd change the core of the question!) You're really only wasting your time - and the number of edits available to you for the day - that you could put to better use editing questions that can profit from your help.
Of course, the temptation to edit as many posts as possible, in order to gain badges, etc. is always there. But if you truly want to contribute to the quality of the site as well as help people with questions, step back and look at the question in its entirety: Is all the information there to make it possible to answer the question? If not,
- post a comment to the OP requesting additional information
- A link to the help center ( [help] ) about how to ask questions is usually in order in such cases
- At the same time, you can mention the code formatting if that's a
problem.
- For people with low rep, always mention they should use
the [edit] link to add the information directly into the question
When you edit, don't concentrate only on code. I review many suggested edits where someone has concentrated on visual formatting (in-line code, bold, etc.) and ignored glaring spelling and grammatical short-comings. Again, look at the entirety. Otherwise there's a good chance your edit will be rejected and the reviewer will make all the necessary corrections - you'll truly have wasted your time.
A very important kind of edit is bringing relevant information from the comments into the question, if the OP fails to do that. This can even be done after a question has been answered, as comments tend to be volatile.
One important point, from my point of view as a review queue reviewer, is to never try to edit a question that has been put on hold. That question gets one chance to be re-opened via the re-open queue, and performing an edit will automatically put it in that queue. But if the edit is just "cosmetic" then OP will have been robbed of the opportunity to substantially improve the question.