Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

source code my one of JavaWorld articles "Automated code reviews with Checkstyle, Part 1" (

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 samples
Octocat-spinner-32 src
Octocat-spinner-32 .classpath
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .project
Octocat-spinner-32 build.bat
Octocat-spinner-32 build.xml
Octocat-spinner-32 custom_check.xml
Octocat-spinner-32 pom.xml
Octocat-spinner-32 run.bat

Checkstyle Samples application

In this application a lot of custom Checkstyle rules have been created. For some, test conditions have been prepared. This document provides the details about them and also on how to run them.


To build the application simply run build.bat on Windows platform or run on UNIX/LINUX platform. You need to have ANT available to build the application. As part of build, it will create classes in bin directory and will create a Jar file inside target directory.

Run the samples

Please note to run the below mentioned checks, please comment other Checks in the custom_check.xml and uncomment the one you want to execute.

MethodCallWithoutObjectCreation Check

This Check provides the instances where a method has been called on an uninitialized variable. To run the test condition use: run.bat samples\

MethodLimitCheck Check

This Check checks the number of methods inside a class. If it exceeds from a pre-determined number, it gives the error. To run the test condition use: run.bat samples\

TraceMessagesCheck Check

This Check checks if for a specific pattern of classes, trace messages for method enter and exit are there or not. To run the test condition use: run.bat samples\

NoStateVariables Check

This Check validates if a pattern of classes contains state variables when those classes are supposed to be stateless. To run the test condition use: run.bat samples\

IllegalMethodCallInLoopCheck Check

This Check checks if a method call has been used in a loop condition. To run the test condition use: run.bat samples\

IllegalExceptionCatchCheck and IllegalExceptionThrowsCheck Check

These two checks focuses on catching instances where something illegal exception type is caught or thrown in methods. To run the test conditions use: run.bat samples\

Something went wrong with that request. Please try again.