Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Checkstyle Plugin for Eclipse

 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone knows if there is an Eclipse plugin that can format the code according to the Checkstyle rules? The Eclipse plugin that I have now can only generate a report for the list of violations. Thanks in advance.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know. But Google's first result was : http://eclipse-cs.sourceforge.net/
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just set up the Eclipse formatting to match whatever rules you use in Checkstyle.

Jalopy can also be used, although I don't know if there's still a plugin for that anymore.
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I don't know. But Google's first result was : http://eclipse-cs.sourceforge.net/

Yes, that plugin is the one that I use. It can tell all the violations of Checkstyle rule, but it's unable to format it according to Checkstyle rule. I guess I need to do what David said. Create a formatter that formats according to Checkstyle rule.

Anyway, thanks all for the replies
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I turn off the formatting checks in CheckStyle and use the Eclipse formatting to determine what the formatting should be. Then I don't have to worry about setting them both to the same thing.

I constantly CTRL-SHIFT-F to reformat. I am ambivalent on the reformat-on-save option, I have some intricately formatted comments, or code/comment combinations, that I don't want touched - sure wish there was as tag, such as <pre> that I could use to tell the Eclipse formatter to not reformat a certain section fo a file - that I would turn on reformat-on-save.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But with Checkstyle rules you can incorporate formatting/naming/etc. rules into a CI machine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic