(no commit message)
[utils] / build-tools / src / main / resources / org.wamblee.checkstyle.xml
diff --git a/build-tools/src/main/resources/org.wamblee.checkstyle.xml b/build-tools/src/main/resources/org.wamblee.checkstyle.xml
new file mode 100644 (file)
index 0000000..17b5a40
--- /dev/null
@@ -0,0 +1,136 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!--
+
+  A Checkstyle configuration that checks against the recommendations
+  in Joshua Bloch, Effective Java (highliy recommended read!)
+
+  This file does NOT duplicate the checks for whitespace settings,
+  placement of curly braces, etc.  Only the rules that are explicitly
+  mentioned in the book are enforced.
+
+  Currently the amount of rules that can be automatically checked by
+  Checkstyle is not very large, but adding more checks of this quality
+  is a high priority goal for the development team.
+
+-->
+
+<module name="Checker">
+
+  <!-- Item 6 - Avoid finalizers -->
+  <module name="RegexpMultiline">
+    <property name="format"
+      value="((public)|(protected))\s+void\s+finalize\(\s*\)"/>
+  </module>
+  
+  <module name="FileTabCharacter"/>
+  
+  <module name="TreeWalker">
+
+    <!-- Item 4 - Avoid creating duplicate objects -->
+    <module name="IllegalInstantiation">
+      <property name="classes" value="java.lang.Boolean, java.lang.String"/>
+    </module>
+
+    <!-- Item 8 - Always override hashCode when you override equals -->
+    <module name="EqualsHashCode"/>
+
+    <!-- Item 12 - Make all fields private -->
+    <module name="VisibilityModifier"/>
+
+    <!-- Item 15 - Design and document for inheritance or else prohibit it -->
+    <!-- the module actually implements a very strict rule, it would be
+         interesting to know whether Joshua meant what checkstyle implements.
+         We feel this implementation is well suited as a warning,
+         i.e. if you get error messages from this check you should be
+         able to name a good reason to implement your code the way you do it,
+         especially if you are designing a library and not an application. -->
+    <!-- module name="DesignForExtension">
+      <property name="severity" value="warning"/>
+    </module -->
+
+    <!-- Item 17 - Use interfaces only to define types -->
+    <module name="InterfaceIsType"/>
+
+    <!-- Item 25 - Design method signatures carefully -->
+    <!-- Avoid long parameter lists -->
+    <module name="ParameterNumber">
+      <property name="max" value="5"/>
+    </module>
+
+    <!-- Item 26 - Use overloading judiciously -->
+    <!-- rfe #659735 -->
+
+    <!-- Item 27 - Return zero-length array, not nulls -->
+    <!-- no rfe yet -->
+
+    <!-- Item 28 - Write doc comments for everything -->
+    <!-- module name="JavadocType">
+      <property name="scope" value="private"/>
+    </module>
+    <module name="JavadocMethod"> 
+      <property name="scope" value="private"/>
+      <property name="allowUndeclaredRTE" value="true"/>
+    </module>
+    <module name="JavadocVariable">
+      <property name="scope" value="private"/>
+    </module -->
+
+    <!-- Item 29 - Minimize the scope of local variables -->
+    <!-- no rfe yet -->
+
+
+    <!-- Item 38 - Adhere to generally accepted naming conventions -->
+    <module name="PackageName">
+      <!-- no uppercase letters, between 2 and 8 characters -->
+      <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,15})*$"/>
+    </module>
+    <module name="TypeName"/>
+    <module name="ConstantName"/>
+    <module name="LocalFinalVariableName"/>
+    <module name="LocalVariableName"/>
+    <module name="MemberName"/>
+    <module name="MethodName"/>
+    <module name="ParameterName">
+      <property name="format" value="^a[A-Z][a-zA-Z0-9]*$"/>
+    </module>
+    <module name="StaticVariableName">
+      <property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
+    </module>
+
+    <!-- Item 47 - Don't ignore exceptions -->
+    <module name="EmptyBlock">
+      <property name="tokens" value="LITERAL_CATCH"/>
+      <!-- require a comment, change to stmt to require a statement -->
+      <property name="option" value="text"/>
+    </module>
+
+    <!-- Item 50 - Never invoke wait outside a loop -->
+    <!-- rfe #712798 -->
+
+    <!-- Item 57 - Provide a readResolve method when necessary -->
+    <!-- no rfe yet -->
+
+    <!-- code layout -->
+    <module name="LeftCurly">
+      <property name="option" value="eol"/>
+    </module>
+    <module name="RightCurly">
+      <property name="option" value="same"/>
+    </module>
+    <module name="NeedBraces"/>
+    <module name="OperatorWrap">
+      <property name="option" value="eol"/>
+    </module>
+    <module name="NoWhitespaceAfter">
+      <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
+    </module>
+    <module name="NoWhitespaceBefore"/>
+    <module name="ParenPad"/>
+
+  </module>
+
+</module>