I use an online auto grader for probably 95% of the assignments my students - high school, AP-A - do in class. Before that I would run unit tests on the submitted code and then leave comments. But I've found that the immediate feedback, especially on smaller assignments, helps them learn to solve the problems on their own. Plus, it saves me from having to look at 10 or 15 versions of their code. I typically only look at the one that works.
For style, I'll leave comments on completed assignments when it's bad.
What I've found really helps though is to not help them with questions if the code is a mess. Especially early in the year "clean up your code, and I'll come back" is my stock answer if it's messy. After a couple times they'll clean it up on their own, and usually they'll figure out the problem on their own.
I don't have specific rules other than it's easy to follow. Coding styles tend to be pretty subjective - braces on the same line, or the next line; should the brace be indented; should an else be on the same line as the brace closing the if. I tell them it's like handwriting. If it's neat, it's easier to read.
I will show examples, both good and bad, anonymously on the board. Some kids don't understand what a good snippet of code looks like. But almost everyone can agree on messy code.