Difference between revisions of "Checkstyle development tool"

From Opentaps Wiki
Jump to navigationJump to search
(Using Checkstyle development tool with Eclipse)
(Using Checkstyle development tool with Eclipse)
 
(3 intermediate revisions by 2 users not shown)
Line 16: Line 16:
 
Enable Checkstyle for a project as described on http://eclipse-cs.sourceforge.net/basic_setup_project.html
 
Enable Checkstyle for a project as described on http://eclipse-cs.sourceforge.net/basic_setup_project.html
  
Depending on project size Checkstyle, working as project builder, can occupy a lot of memory. If required resources become a problem you can deactivate it in project properties and still have possibility check source file manually. To do so select Checkstyle->Check Code with Ckeckstyle in Packahe Explorer context menu for any java (or properties) file.
+
Depending on project size Checkstyle, working as project builder, can occupy a lot of memory. If required resources become a problem you can deactivate it for project and still have possibility check source file manually. Select Checkstyle->Check Code with Ckeckstyle in ''Package Explorer'' context menu for any java (or properties) file.
 +
 
 +
A better solution is to only activate Checkstyle for the files opened in the editor. To do that go to the project Properties > Checkstyle and check Exclude from checking: files not opened in editor.
 +
 
 +
=== Using Checkstyle development tool with IntelliJ IDEA ===
 +
 
 +
Install the Checkstyle plugin from the list of available plugins, which is located at Preferences -> IDE Settings -> Plugins -> Available.  Restart IDEA to load the plugin.
 +
 
 +
Once installed, you can find the Checkstyle configuration under Preferences -> Project Settings -> CheckStyle Plugin.  Opentaps 1.0 comes with a checkstyle definition file in the root directory named <tt>opentaps_checks.xml</tt>.
 +
 
 +
A new button named ''CheckStyle Scan'' should appear on the bottom toolbar.  You can use this to scan for style problems.
 +
 
 +
Source and documentation for this plugin is located at,
 +
 
 +
http://code.google.com/p/checkstyle-idea/

Latest revision as of 13:02, 6 February 2009

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.


Using Checkstyle development tool with Eclipse

As first step you have to install the Eclipse Checkstyle Plug-in via the update site.

  • Within Eclipse go to Help->Software Updates->Available Software
  • Create new update site with Add Site... button.
  • Input a name to your liking (for instance Checkstyle Plug-in) and input the following URL: http://eclipse-cs.sourceforge.net/update
  • Click your way through the following pages to install the plug-in.

Follow this guide http://eclipse-cs.sourceforge.net/basic_creating_config.html and create opentaps check configuration. Select External Configuration File and choose opentaps check config file location.

Enable Checkstyle for a project as described on http://eclipse-cs.sourceforge.net/basic_setup_project.html

Depending on project size Checkstyle, working as project builder, can occupy a lot of memory. If required resources become a problem you can deactivate it for project and still have possibility check source file manually. Select Checkstyle->Check Code with Ckeckstyle in Package Explorer context menu for any java (or properties) file.

A better solution is to only activate Checkstyle for the files opened in the editor. To do that go to the project Properties > Checkstyle and check Exclude from checking: files not opened in editor.

Using Checkstyle development tool with IntelliJ IDEA

Install the Checkstyle plugin from the list of available plugins, which is located at Preferences -> IDE Settings -> Plugins -> Available. Restart IDEA to load the plugin.

Once installed, you can find the Checkstyle configuration under Preferences -> Project Settings -> CheckStyle Plugin. Opentaps 1.0 comes with a checkstyle definition file in the root directory named opentaps_checks.xml.

A new button named CheckStyle Scan should appear on the bottom toolbar. You can use this to scan for style problems.

Source and documentation for this plugin is located at,

http://code.google.com/p/checkstyle-idea/