CheckStyle¶
Checkstyle is a quality control tool allowing to check adherence of java programs to coding standards. Checkstyle is written in java and runs on all platforms.
Features¶
Checkstyle comes by default with configurations files supporting Sun Code Conventions and Google Java Style but nearly everything can be configured. New checks can be written in java classes so nearly all kind of coding standards can virtually be implemented with Checkstyle.
Interoperability¶
Checkstyle is already integrated in many different IDE in the form of plugins for instance. There is a large list of tools related to Checkstyle.
Installation¶
On Ubuntu you can install CheckStyle has following:
sudo apt-get install checkstyle
Installing CheckStyle as a standalone tool is easy:
- Create a directory
%SCRIBESTOOLS%\CheckStyle
. - Download
checkstyle-X.Y-all.jar
web. - Copy the jar file into
%SCRIBESTOOLS%\CheckStyle\checkstyle-all.jar
(remove the version number). - Copy the files
checkstyle.cmd
andcheckstyle.sh
into the directory. - Add the
%SCRIBESTOOLS%\CheckStyle
directory to the path.
Launching CheckStyle¶
You check the installation as following. The option -h
and -v
display
the CheckStyle help and version respectively:
checkstyle -h
checkstyle -v
If you have a java program at hand (let’s say MyProg.java
) and you want to
use Sun Code Conventions on it type:
checkstyle -c /sun_checks.xml MyProg.java