Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate an Eclipse formatter configuration from a checkstyle configuration?

I have a checkstyle configuration XML file and want to automatically generate an Eclipse formatter configuration from this. Is there any tool that can do this?

like image 887
Ken Liu Avatar asked Jun 12 '09 02:06

Ken Liu


People also ask

How do I import a Checkstyle file into Eclipse?

In Eclipse, right-click on the project, and pull down to Properties . Select “Checkstyle” and click on the “Local Check Configurations” tab. Click on New . Select “External Configuration File”, enter a “Name:” and the “Location:” of the file, and click OK .

Can Checkstyle check code layout and formatting issues?

Checkstyle can check many aspects of your source code. It can find class design problems, method design problems. It also has the ability to check code layout and formatting issues.


1 Answers

In Eclipse (3.6):

  • Install Checkstyle plug-in
  • Import stylesheet using Windows --> Preferences, General --> Checkstyle --> New. Since you have an external file, choose "external file" as the type.

Right-click on your project in the Package view and select Checkstyle --> Create Formatter-Profile.

Then enable the formatter for your workspace: Windows --> Preferences --> Java --> Code Style --> Formatter. Select formatter: "eclipse-cs [project name]".

Click OK!

like image 179
Paul Avatar answered Sep 25 '22 17:09

Paul