Added Maven checkstyle plugin.

This commit is contained in:
sk89q 2014-04-04 16:09:22 -07:00
parent ae8becafdd
commit db48f64585
2 changed files with 108 additions and 0 deletions

57
pom.xml
View File

@ -216,7 +216,64 @@
<logViolationsToConsole>true</logViolationsToConsole>
<checkstyleRules>
<module name="Checker">
<!-- Tabs are strictly banned -->
<module name="FileTabCharacter"/>
<module name="TreeWalker">
<!-- Important basics -->
<!-- <module name="PackageDeclaration"/> Unlikely that we would miss this in a PR -->
<module name="OuterTypeFilename"/> <!-- TypeName -> TypeName.java -->
<!--
Control package usage, so people don't insert Bukkit into WE where it shouldn't belong, etc.
It is a bit draconian, so update as necessary!
-->
<module name="ImportControl">
<property name="file" value="${basedir}/src/main/build/import-control.xml"/>
</module>
<!-- Code -->
<module name="HideUtilityClassConstructor"/> <!-- Utility classes should not have a constructor -->
<module name="CovariantEquals"/>
<module name="EqualsHashCode"/> <!-- equals() and hashCode() go together -->
<module name="NestedTryDepth"> <!-- SHOULD not need to adjust this -->
<property name="max" value="2"/>
</module>
<module name="SuperFinalize"/> <!-- We don't actually use this -->
<module name="JUnitTestCase"/> <!-- Checks tearDown(), setUp() etc. -->
<!-- Style -->
<module name="LeftCurly"> <!-- Left brace never goes on another line -->
<property name="option" value="eol"/>
</module> <!-- We don't check right brance -->
<module name="DefaultComesLast"/> <!-- default case in switch should be last -->
<module name="GenericWhitespace"/>
<!-- Naming -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName">
<property name="format" value="^[a-z_][a-zA-Z0-9]*$"/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z_][a-zA-Z0-9]*$"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<!-- <module name="PackageName"/> Unlikely that we would miss this in a PR -->
<module name="ParameterName"/>
<!-- <module name="TypeName"/> Unlikely that we would miss this in a PR -->
</module>
<!-- Require the header, something that many people forget and we hate to fix -->
<!-- You should configure the header in your IDE -->
<module name="Header">
<property name="headerFile" value="${basedir}/src/main/build/header.txt"/>
<property name="fileExtensions" value="java"/>
</module>
</module>
</checkstyleRules>
</configuration>

View File

@ -0,0 +1,51 @@
<!DOCTYPE import-control PUBLIC
"-//Puppy Crawl//DTD Import Control 1.1//EN"
"http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
<import-control pkg="com.sk89q">
<allow pkg="java"/>
<allow pkg="javax"/>
<allow pkg="org.junit"/>
<allow pkg="org.mockito"/>
<allow pkg="com.sk89q"/>
<allow pkg="com.google.common"/>
<subpackage name="util.yaml">
<allow pkg="org.yaml.snakeyaml"/>
</subpackage>
<subpackage name="bukkit">
<allow pkg="org.bukkit"/>
</subpackage>
<subpackage name="wepif">
<allow pkg="org.bukkit"/>
<allow pkg="de.bananaco"/>
<allow pkg="org.anjocaido"/>
<allow pkg="com.nijiko"/>
<allow pkg="com.nijikokun"/>
<allow pkg="ru.tehkode"/>
</subpackage>
<subpackage name="worldedit">
<allow pkg="org.mozilla.javascript"/>
<allow pkg="de.schlichtherle"/>
<subpackage name="bukkit">
<allow pkg="org.bukkit"/>
<allow pkg="net.minecraft.server"/>
</subpackage>
<subpackage name="spout">
<allow pkg="org.spout"/>
<allow pkg="org.jboss.netty"/>
<allow pkg="org.apache"/>
</subpackage>
<subpackage name="forge">
<allow pkg="cpw"/>
<allow pkg="net.minecraft"/>
<allow pkg="net.minecraftforge"/>
</subpackage>
</subpackage>
</import-control>