How to write a custom CheckStyle check and incorporate it into your Maven project
TestProject contains the poorly written Java code that will have checkstyle ran on it
BlundellCheckstyle contains the custom checkstyle checks that have been written
checkstyle-packages.xml would looks something like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE checkstyle-packages PUBLIC
"-//Puppy Crawl//DTD Package Names 1.0//EN"
"http://www.puppycrawl.com/dtds/packages_1_0.dtd">
<checkstyle-packages>
<package name="com.blundell.checks">
</checkstyle-packages>
and you would add it to the maven-checkstyle-plugin declaration
// There are multiple ways to try this, I haven't found one that works
// so I do not want to document it here
then your checkstyle-configuration.xml would not need the package:
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="TreeWalker">
<!-- Blundell specific checks -->
<module name="AntiHungarian" />
</module>
</module>