Checkstyle integration into the Eclipse IDE. Coding standards made easy.
1 Install via Eclipse Marketplace. Drag and drop this link into a running Eclipse Indigo/Juno/Kepler/Luna/Mars/Neon workspaceThe Eclipse Checkstyle Plugin (aka eclipse-cs) integrates the static source code
analyzer Checkstyle into the Eclipse IDE.
Checkstyle is a Open Source development tool to help you
ensure that your Java code adheres to a set of coding standards. Checkstyle does this by inspecting
your Java source code and pointing out items that deviate from a defined set of coding rules.
With the Checkstyle Eclipse Plugin your code is constantly inspected for coding
standard deviations. Within the Eclipse workbench you are immediately notified of problems via the
Eclipse Problems View and source code annotations similar to compiler errors or warnings.
This
ensures an extremely short feedback loop right at the developers fingertips.
If your development team consists of more than one person, then obviously a
common ground for coding standards (formatting rules, line lengths etc.) must be agreed upon - even
if it is just for practical reasons to avoid superficial, format related merge
conflicts.
Checkstyle (and the Eclipse Checkstyle Plugin for that matter) helps you define and
easily apply those common rules.
The plugin uses a project builder to check your project files with
Checkstyle. Assuming the Eclipse Auto-Build feature is enabled each modification of a
project file will immediately get checked by Checkstyle on file save - giving you immediate
feedback about the changes you made. To use a simple analogy, the Checkstyle Plug-in works
very much like a compiler but instead of producing .class files it produces
warnings where your code violates the Checkstyle rules. The discovered deviations are
accessible in the Eclipse Problems View, as code editor annotations and via additional
Checkstyle violations views.
Learn here how to activate
Checkstyle for a project.
The set of rules used to check your code is highly configurable. A
Checkstyle configuration specifies which check rules are validated against your code and
with which severity violations will be reported. Once defined a Checkstyle configuration can
be used across multiple projects. The plugin comes with several pre-defined Checkstyle
configurations.
You can create custom configurations using the plugin's Checkstyle
configuration editor or even use an existing Checkstyle configuration file from an external
location.
A short introduction into creating your own Checkstyle configurations can be
found here.
For more Checkstyle goodness check out the sevntu-checkstyle project, where Roman Ivanov and his
team from the Sevastopol National Technical University, Crimea are assembling a heap of additional
Checkstyle checks.
These checks directly integrate with the eclipse-cs plug-in and can be
installed from the following update site:
http://sevntu-checkstyle.github.com/sevntu.checkstyle/update-site/
Git repository URL: git://git.code.sf.net/p/eclipse-cs/git
Clone the git repository (or create a fork @Sourceforge) and import all projects into your Eclipse workspace.
To build an update site bundle package you will require Apache Maven (3.2.x should do fine).
Open
a command line in project net.sf.eclipsecs.parent
and invoke mvn clean
install
.
Find the installable bundle in
net.sf.eclipsecs-updatesite/target
.