2

I just can't find the option anywhere. Is there some way in eclipse to warn about stuff like this? if(a==b)continue; instead of if(a==b){continue;}

Or can maybe the format function fix this?

Alexander Gessler
  • 45,603
  • 7
  • 82
  • 122
Franz Kafka
  • 10,623
  • 20
  • 93
  • 149
  • 2
    the checkstyle plug-in may do what you want, not sure though. – Kevin D Feb 02 '12 at 16:11
  • 1
    [This answer](http://stackoverflow.com/questions/3704308/how-to-make-eclipse-automatically-add-braces-to-an-if-statement) may help you. – wsams Feb 02 '12 at 16:17

2 Answers2

7

Window-->Preferences--> Java > Editor > Save Actions-->Additional actions-->Configure-->Code Style--> Use blocks in if/while... here you can configure the style you want.

kosa
  • 65,990
  • 13
  • 130
  • 167
  • 1
    Note that this can be configured on a per-project basis, too. Right-click a Project, select Properties, then find Java Code Style > Clean Up in the list. – E-Riz Feb 02 '12 at 16:22
  • @Eric,Agree Eric with your comment. – kosa Feb 02 '12 at 16:23
0

CheckStyle is a nice tool which can also be used as a plugin for eclipse. You can specify different kinds of coding styles you want to enforce on you / your team, by configuring rules in this tool. This could help you create your custom check.

Bala
  • 1,193
  • 2
  • 12
  • 34