eclipse: Configure Check Style Plugin


Introduction


Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard.

Checkstyle is highly configurable and can be made to support almost any coding standard. An example configuration files are supplied supporting the Sun Code Conventions, Google Java Style.

 


Installation Steps


In order to configure and activate check style in your eclipse you need check style plugin installed in your eclipse. You can check check style plugin in your eclipse using window -> preferences option from the top of the menu.

Type checkStyle in the text area and you will find checkStyle option below in the screen. checkStyle already Installed in my eclipse and now project specific CheckStyle can be configure.

eclipse_cs1

 

CheckStyle Plugin installation steps involve installation of plugin on your eclipse so project specific checkStyle can be uploaded.

Please find the steps below –

Step 1: You can install the Checkstyle Eclipse plugin using Eclipse update manager from the following links

http://eclipse-cs.sourceforge.net/update

Step 2: Navigate to Help option from the top menu and click on Install New Software, please find the option in below screenshot

eclipse_cs2 

Step 3: Click on Add button to add above url to download and install plugin in your eclipse. Complete Name and Location information and click on OK button.

eclipse_cs3

Step 4: Once Url added it will start showing CheckStyle package to install in your eclipse as below given screenshot. please click on Next button and complete the installation.

eclipse_cs4

 

Step 5: Above steps helped us to install checkStyle Plugins in eclipse, Now click onWindow and then Preferences to configure project specific CheckStyle.

eclipse_cs1

 

Step 6: Click on New button to configure CheckStyle. Check style configuration page will display.

eclipse_cs5

Step 7: Complete CheckStyle Configuration Page as per above screen and Browse CheckStyle file from your system and click on OK button.

eclipse_cs6

Step 8: After Clicking on OK button above screen display and project specific CheckStyle configured in eclipse. We need to click on Set As Default to make this CheckStyle as default.

After Clicking on Set As Default button project specific CheckStyle will be default.

eclipse_cs7

 

Step 9: Click on OK button to complete the configuration. It will show confirmation window, please click on yes.

Step 10: To execute CheckStyle please right click on Java File and Navigate toCheckstyle -> Check Code with checkStyle option.

eclipse_cs8

 

Step 11: Click on Check Code with checkstyle with give you checkstyle report.

 

CheckStyle File Download Link: Click on below to download checkstyle file.

CheckStyle File

Leave a Reply

Your email address will not be published. Required fields are marked *