Checkstyle is the plug-in for Eclipse IDE. With the help of this plug-in we can improve our Java coding standard. This plug-in provides the availability to check the trailing spaces, unnecessary spaces, tab characters, etc. Checkstyle can help with good programming practices, which improves the code quality, readability, and re-usability of code.

How to Install in Eclipse IDE?

  • Open Eclipse IDE.
  • Go to Help and click on “Eclipse Marketplace” as shown below.

How to Use the Checkstyle Add-on?

  • Enter “Checkstyle plug-in” in the Find input field and click on “Go” button as mentioned in the below-given figure.

Checkstyle plug-in

  • Click on the “Install” button to install the plugin in the Eclipse Editor.
  • Go to Eclipse ->Windows->Preferences->Checkstyle->New and enter the name for the Style code, like “IV-CodeStyle” as shown below.

IV-CodeStyle

  • Click on the “OK” button.
  • Select the created “Check Style” option and click on the “Configure” button.

Check Style

 

  • Select “Whitspace” and then click on the “Add” button to add the standards of whitespace in your created “IV-CodeStyle” configuration.

Whitspace

 

  • Click on the “OK” button.
  • Click on the “Set as Default’ button.

Note: In the same way we can add different Standards for the “Naming Conventions”, “Annotations”, etc.