Portable {}
+````
diff --git a/builder/src/main/resources/rules/JavaNCSS.md b/builder/src/main/resources/rules/JavaNCSS.md
new file mode 100644
index 0000000..c462ea6
--- /dev/null
+++ b/builder/src/main/resources/rules/JavaNCSS.md
@@ -0,0 +1,4 @@
+
+Restricts the NCSS score for methods, classes and files to 40, 1200 and 1600 respectively. The NCSS score is a measure of the number of statements within a scope.
+
+Too high an NCSS score suggests that the method or class is doing too much and should be decomposed into smaller units.
diff --git a/builder/src/main/resources/rules/JavadocMethod.md b/builder/src/main/resources/rules/JavadocMethod.md
new file mode 100644
index 0000000..dda8aa1
--- /dev/null
+++ b/builder/src/main/resources/rules/JavadocMethod.md
@@ -0,0 +1,2 @@
+
+Checks that all public, protected and package methods have a Javadoc block, that all `@throws` tags are used. Basic setters and getters do not require javadoc.
diff --git a/builder/src/main/resources/rules/JavadocPackage.md b/builder/src/main/resources/rules/JavadocPackage.md
new file mode 100644
index 0000000..5b863ae
--- /dev/null
+++ b/builder/src/main/resources/rules/JavadocPackage.md
@@ -0,0 +1,2 @@
+
+Checks that each package has a `package-info.java` file.
diff --git a/builder/src/main/resources/rules/JavadocParagraph.md b/builder/src/main/resources/rules/JavadocParagraph.md
new file mode 100644
index 0000000..08d0aa1
--- /dev/null
+++ b/builder/src/main/resources/rules/JavadocParagraph.md
@@ -0,0 +1,2 @@
+
+Checks that paragraphs in Javadoc blocks are wrapped in `` elements and have blank lines between paragraphs. This first paragraph does not need the `
` elements.
diff --git a/builder/src/main/resources/rules/JavadocStyle.md b/builder/src/main/resources/rules/JavadocStyle.md
new file mode 100644
index 0000000..6dc77fd
--- /dev/null
+++ b/builder/src/main/resources/rules/JavadocStyle.md
@@ -0,0 +1,2 @@
+
+Checks the formatting of the Javadoc blocks. See the official [Checkstyle documentation](http://checkstyle.sourceforge.net/config_javadoc.html#JavadocStyle) for all the checks that are applied.
diff --git a/builder/src/main/resources/rules/JavadocType.md b/builder/src/main/resources/rules/JavadocType.md
new file mode 100644
index 0000000..982268a
--- /dev/null
+++ b/builder/src/main/resources/rules/JavadocType.md
@@ -0,0 +1,2 @@
+
+Checks the format for Javadoc for classes and enums. Javadoc must be present, not have any unknown tags and not missing any `@param` tags. The `@author` tag must have a name and, in brackets, an email address.
diff --git a/builder/src/main/resources/rules/LeftCurly.md b/builder/src/main/resources/rules/LeftCurly.md
new file mode 100644
index 0000000..7c69f72
--- /dev/null
+++ b/builder/src/main/resources/rules/LeftCurly.md
@@ -0,0 +1,16 @@
+
+Checks that the left curly brace ('{') is placed at the end of the line. Does not check enums.
+
+Valid:
+````
+class Foo {
+}
+````
+
+Invalid:
+````
+class Bar
+{
+
+}
+````
diff --git a/builder/src/main/resources/rules/LineLength.md b/builder/src/main/resources/rules/LineLength.md
new file mode 100644
index 0000000..fce37e7
--- /dev/null
+++ b/builder/src/main/resources/rules/LineLength.md
@@ -0,0 +1,4 @@
+
+Limits the line length to 120 characters.
+
+Doesn't check package or import lines.
diff --git a/builder/src/main/resources/rules/LocalFinalVariableName.md b/builder/src/main/resources/rules/LocalFinalVariableName.md
new file mode 100644
index 0000000..831ace8
--- /dev/null
+++ b/builder/src/main/resources/rules/LocalFinalVariableName.md
@@ -0,0 +1,4 @@
+
+Checks the format of local, `final` variable names, including `catch` parameters.
+
+Identifiers must match `^[a-z][a-zA-Z0-9]*$`.
diff --git a/builder/src/main/resources/rules/LocalVariableName.md b/builder/src/main/resources/rules/LocalVariableName.md
new file mode 100644
index 0000000..c21e293
--- /dev/null
+++ b/builder/src/main/resources/rules/LocalVariableName.md
@@ -0,0 +1,4 @@
+
+Checks the format of local, non-`final` variable names.
+
+Identifiers must match `^[a-z][a-zA-Z0-9]*$`.
diff --git a/builder/src/main/resources/rules/LogicConditionNeedOptimization.md b/builder/src/main/resources/rules/LogicConditionNeedOptimization.md
new file mode 100644
index 0000000..50a05b3
--- /dev/null
+++ b/builder/src/main/resources/rules/LogicConditionNeedOptimization.md
@@ -0,0 +1,12 @@
+
+Prevent the placement of variables or fields after methods in an expression.
+
+Valid:
+````
+if (property && getProperty()) {}
+````
+
+Invalid:
+````
+if (getProperty() && property) {}
+````
diff --git a/builder/src/main/resources/rules/MagicNumber.md b/builder/src/main/resources/rules/MagicNumber.md
new file mode 100644
index 0000000..4a14f33
--- /dev/null
+++ b/builder/src/main/resources/rules/MagicNumber.md
@@ -0,0 +1,15 @@
+
+Checks that numeric literals are defined as constants. Being constants they then have a name that aids in making them non-magical.
+
+The numbers -1, 0, 1 and 2 are not considered to be magical.
+
+Valid:
+````
+static final int SECONDS_PER_DAY = 24 * 60 * 60;
+static final Border STANDARD_BORDER = BorderFactory.createEmptyBorder(3, 3, 3, 3);
+````
+
+Invalid
+````
+String item = getItem(200);
+````
diff --git a/builder/src/main/resources/rules/MapIterationInForEachLoop.md b/builder/src/main/resources/rules/MapIterationInForEachLoop.md
new file mode 100644
index 0000000..359b645
--- /dev/null
+++ b/builder/src/main/resources/rules/MapIterationInForEachLoop.md
@@ -0,0 +1,2 @@
+
+Checks for unoptimised iterations over `Map`s. Check use of `map.values()`, `map.keySet()` and `map.entrySet()` against the use of the iterator produced to verify if another could be better.
diff --git a/builder/src/main/resources/rules/MemberName.md b/builder/src/main/resources/rules/MemberName.md
new file mode 100644
index 0000000..763ed38
--- /dev/null
+++ b/builder/src/main/resources/rules/MemberName.md
@@ -0,0 +1,4 @@
+
+Checks the format of non-static field names.
+
+Identifiers must match `^[a-z][a-zA-Z0-9]*$`.
diff --git a/builder/src/main/resources/rules/MethodCount.md b/builder/src/main/resources/rules/MethodCount.md
new file mode 100644
index 0000000..0140136
--- /dev/null
+++ b/builder/src/main/resources/rules/MethodCount.md
@@ -0,0 +1,2 @@
+
+Restricts the number of methods in a type to 30.
diff --git a/builder/src/main/resources/rules/MethodLength.md b/builder/src/main/resources/rules/MethodLength.md
new file mode 100644
index 0000000..0f647b5
--- /dev/null
+++ b/builder/src/main/resources/rules/MethodLength.md
@@ -0,0 +1,2 @@
+
+Restricts the number of lines in a method to 60. Include blank lines and single line comments. You should be able to see an entire method without needing to scroll.
diff --git a/builder/src/main/resources/rules/MethodName.md b/builder/src/main/resources/rules/MethodName.md
new file mode 100644
index 0000000..514b930
--- /dev/null
+++ b/builder/src/main/resources/rules/MethodName.md
@@ -0,0 +1,4 @@
+
+Checks the format of method names.
+
+Identifiers must match `^[a-z][a-zA-Z0-9]*$`.
diff --git a/builder/src/main/resources/rules/MethodParamPad.md b/builder/src/main/resources/rules/MethodParamPad.md
new file mode 100644
index 0000000..b03bdf7
--- /dev/null
+++ b/builder/src/main/resources/rules/MethodParamPad.md
@@ -0,0 +1,15 @@
+
+Checks that the padding between the method identifier and the left parenthesis is on the same line and doesn't have a space in-between.
+
+Valid:
+````
+void getInstance();
+````
+
+Invalid:
+````
+void getInstance ();
+
+void getValue
+ ();
+````
diff --git a/builder/src/main/resources/rules/MethodTypeParameterName.md b/builder/src/main/resources/rules/MethodTypeParameterName.md
new file mode 100644
index 0000000..efb436c
--- /dev/null
+++ b/builder/src/main/resources/rules/MethodTypeParameterName.md
@@ -0,0 +1,14 @@
+
+Restricts method generics parameters to be a single uppercase letter.
+
+Valid:
+````
+List getItems() {}
+````
+
+Invalid:
+````
+List getItems() {}
+List getItems() {}
+List getItems() {}
+````
diff --git a/builder/src/main/resources/rules/MissingDeprecated.md b/builder/src/main/resources/rules/MissingDeprecated.md
new file mode 100644
index 0000000..9db91dc
--- /dev/null
+++ b/builder/src/main/resources/rules/MissingDeprecated.md
@@ -0,0 +1,29 @@
+
+Both the `@Deprecated` annotation and the Javadoc tag `@deprecated` must be used in pairs.
+
+Valid:
+````
+/**
+ * Foo.
+ *
+ * @deprecated
+ */
+@Deprecated
+void foo() {}
+````
+
+Invalid:
+````
+/**
+ * Foo.
+ */
+@Deprecated
+void foo() {}
+
+/**
+ * Bar.
+ *
+ * @deprecated
+ */
+void bar() {}
+````
diff --git a/builder/src/main/resources/rules/MissingSwitchDefault.md b/builder/src/main/resources/rules/MissingSwitchDefault.md
new file mode 100644
index 0000000..390c2ba
--- /dev/null
+++ b/builder/src/main/resources/rules/MissingSwitchDefault.md
@@ -0,0 +1,28 @@
+
+Checks that `switch` statement has a `default` case.
+
+Valid:
+````
+switch (foo) {
+ case 1:
+ //
+ break;
+ case 2:
+ //
+ break;
+ default:
+ throw new IllegalStateExcetion("Foo: " + foo);
+}
+````
+
+Invalid:
+````
+switch (foo) {
+ case 1:
+ //
+ break;
+ case 2:
+ //
+ break;
+}
+````
diff --git a/builder/src/main/resources/rules/ModifiedControlVariable.md b/builder/src/main/resources/rules/ModifiedControlVariable.md
new file mode 100644
index 0000000..a77b106
--- /dev/null
+++ b/builder/src/main/resources/rules/ModifiedControlVariable.md
@@ -0,0 +1,9 @@
+
+Checks that the control variable in a `for` loop is not modified inside the loop.
+
+Invalid:
+````
+for (int i = 0; i < 1; i++) {
+ i++;
+}
+````
diff --git a/builder/src/main/resources/rules/ModifierOrder.md b/builder/src/main/resources/rules/ModifierOrder.md
new file mode 100644
index 0000000..ebc469c
--- /dev/null
+++ b/builder/src/main/resources/rules/ModifierOrder.md
@@ -0,0 +1,16 @@
+
+Check that modifiers are in the following order:
+
+* `public`
+* `protected`
+* `private`
+* `abstract`
+* `static`
+* `final`
+* `transient`
+* `volatile`
+* `synchronized`
+* `native`
+* `strictfp`
+
+Type annotations are ignored.
diff --git a/builder/src/main/resources/rules/MultipleStringLiterals.md b/builder/src/main/resources/rules/MultipleStringLiterals.md
new file mode 100644
index 0000000..58c3737
--- /dev/null
+++ b/builder/src/main/resources/rules/MultipleStringLiterals.md
@@ -0,0 +1,7 @@
+
+Checks for multiple occurrences of the same string literal within a single file. Does not apply to empty strings ("").
+
+Invalid:
+````
+String fooFoo = "foo" + "foo";
+````
diff --git a/builder/src/main/resources/rules/MultipleVariableDeclarations.md b/builder/src/main/resources/rules/MultipleVariableDeclarations.md
new file mode 100644
index 0000000..efe6f25
--- /dev/null
+++ b/builder/src/main/resources/rules/MultipleVariableDeclarations.md
@@ -0,0 +1,13 @@
+
+Checks that each variable is declared in its own statement and line.
+
+Valid:
+````
+int a;
+int b;
+````
+
+Invalid:
+````
+int a, b;
+````
diff --git a/builder/src/main/resources/rules/MutableException.md b/builder/src/main/resources/rules/MutableException.md
new file mode 100644
index 0000000..704d664
--- /dev/null
+++ b/builder/src/main/resources/rules/MutableException.md
@@ -0,0 +1,8 @@
+
+Checks that `Exception` classes are immutable. However, you can still call `setStackTrace`.
+
+Classes checked are those whose name ends with the following. Or that the class they extend does.
+
+* `Exception`
+* `Error`
+* `Throwable`
diff --git a/builder/src/main/resources/rules/NPathComplexity.md b/builder/src/main/resources/rules/NPathComplexity.md
new file mode 100644
index 0000000..e0764c7
--- /dev/null
+++ b/builder/src/main/resources/rules/NPathComplexity.md
@@ -0,0 +1,2 @@
+
+Checks that the NPATH score (number of paths) through a method is no more than 5. This is similar to [Cyclomatic Complexity](#cyclomaticcomplexity).
diff --git a/builder/src/main/resources/rules/NameConventionForJunit4TestClasses.md b/builder/src/main/resources/rules/NameConventionForJunit4TestClasses.md
new file mode 100644
index 0000000..0567e37
--- /dev/null
+++ b/builder/src/main/resources/rules/NameConventionForJunit4TestClasses.md
@@ -0,0 +1,4 @@
+
+Checks the names of JUnit test classes. Classes checked are those that have at least one method annotated with `Test` or `org.junit.Test`.
+
+Test class names must match: `.+Test\\d*|.+Tests\\d*|Test.+|Tests.+|.+IT|.+ITs|.+TestCase\\d*|.+TestCases\\d*`
diff --git a/builder/src/main/resources/rules/NeedBraces.md b/builder/src/main/resources/rules/NeedBraces.md
new file mode 100644
index 0000000..71bee0f
--- /dev/null
+++ b/builder/src/main/resources/rules/NeedBraces.md
@@ -0,0 +1,32 @@
+
+Check that code blocks are surrounded by braces.
+
+Valid:
+````
+if (obj.isValid()) {
+ return true;
+}
+
+while (obj.isValid()) {
+ return true;
+}
+
+do {
+ this.notify();
+} while (o != null);
+
+for (int i = 0; ;) {
+ this.notify();
+}
+````
+
+Invalid:
+````
+if (obj.isValid()) return true;
+
+while (obj.isValid()) return true;
+
+do this.notify(); while (o != null);
+
+for (int i = 0; ;) this.notify();
+````
diff --git a/builder/src/main/resources/rules/NestedForDepth.md b/builder/src/main/resources/rules/NestedForDepth.md
new file mode 100644
index 0000000..e70236c
--- /dev/null
+++ b/builder/src/main/resources/rules/NestedForDepth.md
@@ -0,0 +1,22 @@
+
+Checks that `for` loops are not nested more than 1 deep.
+
+Valid:
+````
+for (int i = 0; i < 1; i++) { // depth 0
+ for (int j = 0; j < 1; j++) { // depth 1
+ //
+ }
+}
+````
+
+Invalid:
+````
+for (int i = 0; i < 1; i++) { // depth 0
+ for (int j = 0; j < 1; j++) { // depth 1
+ for (int k = 0; j < 1; k++) { // depth 2!
+ //
+ }
+ }
+}
+````
diff --git a/builder/src/main/resources/rules/NestedIfDepth.md b/builder/src/main/resources/rules/NestedIfDepth.md
new file mode 100644
index 0000000..3657433
--- /dev/null
+++ b/builder/src/main/resources/rules/NestedIfDepth.md
@@ -0,0 +1,22 @@
+
+Checks that `if` blocks are not nested more than 1 deep.
+
+Valid:
+````
+if (isValid()) { // depth 0
+ if (isExpected()) { // depth 1
+ doIt();
+ }
+}
+````
+
+Invalid:
+````
+if (isValid()) { // depth 0
+ if (isExpected()) { // depth 1
+ if (isNecessary()) { // depth 2!
+ doIt();
+ }
+ }
+}
+````
diff --git a/builder/src/main/resources/rules/NestedSwitch.md b/builder/src/main/resources/rules/NestedSwitch.md
new file mode 100644
index 0000000..74af425
--- /dev/null
+++ b/builder/src/main/resources/rules/NestedSwitch.md
@@ -0,0 +1,47 @@
+
+Checks that `switch` statements are not nested within one another.
+
+Valid:
+````
+void doSomething(int a, int b) {
+
+ switch(a) {
+ case 1:
+ doMore(b);
+ break;
+ case 2:
+ // ..
+ }
+ }
+}
+
+void doMore(int b) {
+
+ switch(b) {
+ case 1:
+ //
+ case 2:
+ //
+ }
+}
+````
+
+Invalid:
+````
+void doSomething(int a, int b) {
+
+ switch(a) {
+ case 1:
+ switch(b) {
+ case 1:
+ //
+ case 2:
+ //
+ }
+ break;
+ case 2:
+ // ..
+ }
+ }
+}
+````
diff --git a/builder/src/main/resources/rules/NestedTryDepth.md b/builder/src/main/resources/rules/NestedTryDepth.md
new file mode 100644
index 0000000..52803f3
--- /dev/null
+++ b/builder/src/main/resources/rules/NestedTryDepth.md
@@ -0,0 +1,28 @@
+
+Checks that `try` blocks are not nested.
+
+Valid:
+````
+try {
+ doSomething();
+ doSomeOtherThing();
+} catch (SomeException se) {
+ // handle it
+} catch (OtherExceptions oe) {
+ // handle it
+}
+````
+
+Invalid:
+````
+try {
+ doSomething();
+ try {
+ doSomeOtherThing();
+ } catch (OtherExceptions oe) {
+ // handle it
+ }
+} catch (SomeException se) {
+ // handle it
+}
+````
diff --git a/builder/src/main/resources/rules/NewlineAtEndOfFile.md b/builder/src/main/resources/rules/NewlineAtEndOfFile.md
new file mode 100644
index 0000000..4c6c176
--- /dev/null
+++ b/builder/src/main/resources/rules/NewlineAtEndOfFile.md
@@ -0,0 +1,2 @@
+
+Checks that files end with a line-feed character, (i.e. unix-style line ending).
diff --git a/builder/src/main/resources/rules/NoClone.md b/builder/src/main/resources/rules/NoClone.md
new file mode 100644
index 0000000..6cf0e0a
--- /dev/null
+++ b/builder/src/main/resources/rules/NoClone.md
@@ -0,0 +1,6 @@
+
+> This check cannot be suppressed.
+
+Checks that the `clone()` method from `Object` has not been overridden. Use a copy constructor, or better yet, a static factory method.
+
+> See [Effective Java], 2nd Edition by Josh Bloch: Item 11: Override clone judiciously.
diff --git a/builder/src/main/resources/rules/NoFinalizer.md b/builder/src/main/resources/rules/NoFinalizer.md
new file mode 100644
index 0000000..8ca9790
--- /dev/null
+++ b/builder/src/main/resources/rules/NoFinalizer.md
@@ -0,0 +1,4 @@
+
+Checks that the `finalize()` method from `Object` has not been overridden.
+
+> See [Effective Java], 2nd Edition by Josh Bloch: Item 7: Avoid finalizers.
diff --git a/builder/src/main/resources/rules/NoLineWrap.md b/builder/src/main/resources/rules/NoLineWrap.md
new file mode 100644
index 0000000..8304ab0
--- /dev/null
+++ b/builder/src/main/resources/rules/NoLineWrap.md
@@ -0,0 +1,2 @@
+
+Prevents wrapping of `package` and `import` statements.
diff --git a/builder/src/main/resources/rules/NoMainMethodInAbstractClass.md b/builder/src/main/resources/rules/NoMainMethodInAbstractClass.md
new file mode 100644
index 0000000..912ab2a
--- /dev/null
+++ b/builder/src/main/resources/rules/NoMainMethodInAbstractClass.md
@@ -0,0 +1,2 @@
+
+Prevents a `main` method from existing in an `abstract` class.
diff --git a/builder/src/main/resources/rules/NoWhitespaceAfter.md b/builder/src/main/resources/rules/NoWhitespaceAfter.md
new file mode 100644
index 0000000..bdf5ee9
--- /dev/null
+++ b/builder/src/main/resources/rules/NoWhitespaceAfter.md
@@ -0,0 +1,30 @@
+
+Checks that there is no whitespace after the array init ('{'), prefix increment ('++'), prefix decrement ('--'), bitwise complement ('~'), logical complement ('!'), array declaration ('[' in `int[] a;`) or array index operator ('[' in `a[2]`).
+
+Valid:
+````
+int[] y = {1, 2};
+++i;
+--i;
+int j = -1;
+int k = +1;
+int l = ~2;
+boolean state = !isReady();
+int b = o.getValue();
+int[] a;
+int d = a[2];
+````
+
+Invalid:
+````
+int[] y = { 1, 2 };
+++ i;
+-- i;
+int j = - 1;
+int k = + 1;
+int l = ~ 2;
+boolean state = ! isReady();
+int b = o. getValue();
+int[ ] a;
+int d = a[ 2];
+````
diff --git a/builder/src/main/resources/rules/NoWhitespaceBefore.md b/builder/src/main/resources/rules/NoWhitespaceBefore.md
new file mode 100644
index 0000000..0be2a07
--- /dev/null
+++ b/builder/src/main/resources/rules/NoWhitespaceBefore.md
@@ -0,0 +1,18 @@
+
+Checks that there is no whitespace before the comma operator (','), statement terminator (';'), postfix increment ('++') or postfix decrement ('--').
+
+Valid:
+````
+int y = {1, 2};
+doSomething();
+i++;
+i--;
+````
+
+Invalid:
+````
+int y = {1 , 2};
+doSomething() ;
+i ++;
+i --;
+````
diff --git a/builder/src/main/resources/rules/NonEmptyAtclauseDescription.md b/builder/src/main/resources/rules/NonEmptyAtclauseDescription.md
new file mode 100644
index 0000000..74e4c3f
--- /dev/null
+++ b/builder/src/main/resources/rules/NonEmptyAtclauseDescription.md
@@ -0,0 +1,20 @@
+
+Checks that the Javadoc clauses `@param`, `@return`, `@throws` and `@deprecated` all have descriptions.
+
+Valid:
+````
+/**
+ * Foo.
+ *
+ * @returns the foo
+ */
+````
+
+Invalid:
+````
+/**
+ * Foo.
+ *
+ * @returns
+ */
+````
diff --git a/builder/src/main/resources/rules/NumericLiteralNeedsUnderscore.md b/builder/src/main/resources/rules/NumericLiteralNeedsUnderscore.md
new file mode 100644
index 0000000..c509c42
--- /dev/null
+++ b/builder/src/main/resources/rules/NumericLiteralNeedsUnderscore.md
@@ -0,0 +1,17 @@
+
+Checks that numeric literals use underscores ('_') if over a certain length.
+
+* Decimals
+
+ * 7 or more digits must use the underscore
+ * No more than 3 digits between underscores
+
+* Hex
+
+ * 5 or more digits must use the underscore
+ * No more than 4 digits between underscores
+
+* Binary
+
+ * 9 or more digits must use the underscore
+ * No more than 8 digits between underscores
diff --git a/builder/src/main/resources/rules/OneStatementPerLine.md b/builder/src/main/resources/rules/OneStatementPerLine.md
new file mode 100644
index 0000000..7ea4355
--- /dev/null
+++ b/builder/src/main/resources/rules/OneStatementPerLine.md
@@ -0,0 +1,13 @@
+
+Checks that there is only one statement per line.
+
+Valid:
+````
+doSomething();
+doSomethingElse();
+````
+
+Invalid:
+````
+doSomething(); doSomethingElse();
+````
diff --git a/builder/src/main/resources/rules/OneTopLevelClass.md b/builder/src/main/resources/rules/OneTopLevelClass.md
new file mode 100644
index 0000000..eaae30e
--- /dev/null
+++ b/builder/src/main/resources/rules/OneTopLevelClass.md
@@ -0,0 +1,4 @@
+
+> This check cannot be suppressed.
+
+Checks that each source file contains only one top-level class, interface or enum.
diff --git a/builder/src/main/resources/rules/OperatorWrap.md b/builder/src/main/resources/rules/OperatorWrap.md
new file mode 100644
index 0000000..6af32fb
--- /dev/null
+++ b/builder/src/main/resources/rules/OperatorWrap.md
@@ -0,0 +1,14 @@
+
+Checks that when wrapping a line on an operator that the operator appears on the new line.
+
+Valid:
+````
+int answer = getTheAnswerToLife() + getTheAnswerToTheUniverse()
+ + getTheAnswerToEverything();
+````
+
+Invalid:
+````
+int answer = getTheAnswerToLife() + getTheAnswerToTheUniverse() +
+ getTheAnswerToEverything();
+````
diff --git a/builder/src/main/resources/rules/OuterTypeFilename.md b/builder/src/main/resources/rules/OuterTypeFilename.md
new file mode 100644
index 0000000..2638311
--- /dev/null
+++ b/builder/src/main/resources/rules/OuterTypeFilename.md
@@ -0,0 +1,4 @@
+
+> This check cannot be suppressed.
+
+Checks that the source filename matches the name of the top-level class. e.g. `class Foo {}` is in file `Foo.java`.
diff --git a/builder/src/main/resources/rules/OverloadMethodsDeclarationOrder.md b/builder/src/main/resources/rules/OverloadMethodsDeclarationOrder.md
new file mode 100644
index 0000000..f521c12
--- /dev/null
+++ b/builder/src/main/resources/rules/OverloadMethodsDeclarationOrder.md
@@ -0,0 +1,2 @@
+
+Checks that overload methods are grouped together in the source file.
diff --git a/builder/src/main/resources/rules/OverridableMethodInConstructor.md b/builder/src/main/resources/rules/OverridableMethodInConstructor.md
new file mode 100644
index 0000000..8c82eb6
--- /dev/null
+++ b/builder/src/main/resources/rules/OverridableMethodInConstructor.md
@@ -0,0 +1,21 @@
+
+Prevents calls to overridable methods from constuctors including other methods that perform the same functions. (i.e. `Cloneable.clone()` and `Serializable.readObject()`)
+
+Invalid:
+````
+abstract class Base {
+ Base() {
+ overrideMe();
+ }
+}
+class Child extends Base {
+ final int x;
+ Child(int x) {
+ this.x = x;
+ }
+ void overrideMe() {
+ System.out.println(x);
+ }
+}
+new Child(42); // prints "0"
+````
diff --git a/builder/src/main/resources/rules/PackageAnnotation.md b/builder/src/main/resources/rules/PackageAnnotation.md
new file mode 100644
index 0000000..436e3ff
--- /dev/null
+++ b/builder/src/main/resources/rules/PackageAnnotation.md
@@ -0,0 +1,2 @@
+
+Checks that package level annotations are in the `package-info.java` file.
diff --git a/builder/src/main/resources/rules/PackageDeclaration.md b/builder/src/main/resources/rules/PackageDeclaration.md
new file mode 100644
index 0000000..8ea13e9
--- /dev/null
+++ b/builder/src/main/resources/rules/PackageDeclaration.md
@@ -0,0 +1,4 @@
+
+> This check cannot be suppressed.
+
+Checks that the class has a `package` definition.
diff --git a/builder/src/main/resources/rules/PackageName.md b/builder/src/main/resources/rules/PackageName.md
new file mode 100644
index 0000000..11c7f62
--- /dev/null
+++ b/builder/src/main/resources/rules/PackageName.md
@@ -0,0 +1,4 @@
+
+Checks the format of package names. Only lowercase letters, no initial numbers or any underscores.
+
+Identifiers must match `^[a-z]+(\.[a-z][a-z0-9]+)*$`.
diff --git a/builder/src/main/resources/rules/ParameterName.md b/builder/src/main/resources/rules/ParameterName.md
new file mode 100644
index 0000000..8e7a772
--- /dev/null
+++ b/builder/src/main/resources/rules/ParameterName.md
@@ -0,0 +1,4 @@
+
+Checks the format of method parameter names, including `catch` parameters.
+
+Identifiers must match `^[a-z][a-zA-Z0-9]*$`.
diff --git a/builder/src/main/resources/rules/ParameterNumber.md b/builder/src/main/resources/rules/ParameterNumber.md
new file mode 100644
index 0000000..8e5b8e5
--- /dev/null
+++ b/builder/src/main/resources/rules/ParameterNumber.md
@@ -0,0 +1,2 @@
+
+Restricts the number of parameters in a method or constructor to 7. Overridden methods are not checked as there may be no access to change the super method.
diff --git a/builder/src/main/resources/rules/ParenPad.md b/builder/src/main/resources/rules/ParenPad.md
new file mode 100644
index 0000000..eb70267
--- /dev/null
+++ b/builder/src/main/resources/rules/ParenPad.md
@@ -0,0 +1,15 @@
+
+Checks that there are no spaces padding parentheses.
+
+Valid:
+````
+doSomething();
+doSomethingElse(5);
+````
+
+Invalid:
+````
+doSomething( );
+doSomethingElse( 5);
+doSomethingElse(5 );
+````
diff --git a/builder/src/main/resources/rules/PublicReferenceToPrivateType.md b/builder/src/main/resources/rules/PublicReferenceToPrivateType.md
new file mode 100644
index 0000000..6b78de5
--- /dev/null
+++ b/builder/src/main/resources/rules/PublicReferenceToPrivateType.md
@@ -0,0 +1,14 @@
+
+Checks that a type is not exposed outside its declared scope.
+
+Invalid:
+````
+public class OuterClass {
+ public InnerClass inner = new InnerClass();
+ public SiblingClass sibling = new SiblingClass();
+ public InnerClass getValue() { return new InnerClass(); }
+ public SiblingClass getSibling() { return new SiblingClass(); }
+ private class InnerClass {}
+}
+class SiblingClass {}
+````
diff --git a/builder/src/main/resources/rules/RedundantModifier.md b/builder/src/main/resources/rules/RedundantModifier.md
new file mode 100644
index 0000000..1732f35
--- /dev/null
+++ b/builder/src/main/resources/rules/RedundantModifier.md
@@ -0,0 +1,8 @@
+
+Checks for redundant modifiers. Checks for:
+
+* Interface and annotation definitions.
+* Final modifier on methods of final and anonymous classes.
+* Inner interface declarations that are declared as static.
+* Class constructors.
+* Nested enum definitions that are declared as static.
diff --git a/builder/src/main/resources/rules/RedundantReturn.md b/builder/src/main/resources/rules/RedundantReturn.md
new file mode 100644
index 0000000..50974bf
--- /dev/null
+++ b/builder/src/main/resources/rules/RedundantReturn.md
@@ -0,0 +1,14 @@
+
+Checks for redundant return statements.
+
+Invalid:
+````
+HelloWorld() {
+ doStuff();
+ return;
+}
+void doStuff() {
+ doMoreStuff();
+ return;
+}
+````
diff --git a/builder/src/main/resources/rules/RequireThis.md b/builder/src/main/resources/rules/RequireThis.md
new file mode 100644
index 0000000..5eab1a6
--- /dev/null
+++ b/builder/src/main/resources/rules/RequireThis.md
@@ -0,0 +1,2 @@
+
+Checks that references to instance fields where a parameter name overlaps are qualified by `this.`.
diff --git a/builder/src/main/resources/rules/ReturnBooleanFromTernary.md b/builder/src/main/resources/rules/ReturnBooleanFromTernary.md
new file mode 100644
index 0000000..2f7f7fd
--- /dev/null
+++ b/builder/src/main/resources/rules/ReturnBooleanFromTernary.md
@@ -0,0 +1,14 @@
+
+Ternary statements shouldn't have `Boolean` values as results.
+
+Valid:
+````
+Boolean set = isSet() ? True : False;
+Boolean notReady = isReady() ? False : True;
+````
+
+Invalid:
+````
+Boolean set = isSet();
+Boolean notReady = !isReady();
+````
diff --git a/builder/src/main/resources/rules/ReturnCount.md b/builder/src/main/resources/rules/ReturnCount.md
new file mode 100644
index 0000000..b5995c1
--- /dev/null
+++ b/builder/src/main/resources/rules/ReturnCount.md
@@ -0,0 +1,40 @@
+
+Restricts methods to have at most 2 `return` statements in non-void methods, and at most 1 in void methods.
+
+Valid:
+````
+int getNumber(int a) {
+ if (a > 1) {
+ return a;
+ }
+ return 0;
+}
+
+void getName(int a) {
+ String name = "default";
+ if (a > 1) {
+ name = "Bob";
+ }
+ return name;
+}
+````
+
+Invalid:
+````
+int getNumber(int a) {
+ if (a > 1) {
+ return a;
+ }
+ if (a < 2) {
+ return a * a;
+ }
+ return 0;
+}
+
+void getName(int a) {
+ if (a > 1) {
+ return "Bob";
+ }
+ return "default";
+}
+````
diff --git a/builder/src/main/resources/rules/ReturnNullInsteadOfBoolean.md b/builder/src/main/resources/rules/ReturnNullInsteadOfBoolean.md
new file mode 100644
index 0000000..737bf38
--- /dev/null
+++ b/builder/src/main/resources/rules/ReturnNullInsteadOfBoolean.md
@@ -0,0 +1,15 @@
+
+The `Boolean` type is meant to only represent a binary state: TRUE or FALSE. It is not a ternary value: TRUE, FALSE, null.
+
+Invalid:
+````
+Boolean isEnabled() {
+ if (level > 0) {
+ return True;
+ }
+ if (level < 0) {
+ return False;
+ }
+ return null;
+}
+````
\ No newline at end of file
diff --git a/builder/src/main/resources/rules/RightCurly.md b/builder/src/main/resources/rules/RightCurly.md
new file mode 100644
index 0000000..90407db
--- /dev/null
+++ b/builder/src/main/resources/rules/RightCurly.md
@@ -0,0 +1,45 @@
+
+Checks that the right curly brace ('}') is placed on the same line as the next part of a multi-block statement (e.g. try-catch-finally, if-then-else).
+
+Valid:
+````
+try {
+ //
+} catch (Exception e) {
+ //
+} finally {
+ //
+}
+
+if (a > 0) {
+ //
+} else {
+ //
+}
+````
+
+Invalid:
+````
+try {
+ //
+}
+catch (Exception e) {
+ //
+}
+finally {
+ //
+}
+
+if (a > 0) {
+ //
+}
+else {
+ //
+}
+
+if (a > 0) {
+ //
+} a = 2;
+
+public long getId() {return id;}
+````
diff --git a/builder/src/main/resources/rules/SeparatorWrap.md b/builder/src/main/resources/rules/SeparatorWrap.md
new file mode 100644
index 0000000..1f3db49
--- /dev/null
+++ b/builder/src/main/resources/rules/SeparatorWrap.md
@@ -0,0 +1,21 @@
+
+Checks the line wrapping around separators.
+
+* The comma separator (',') should be at the end of the line.
+* The dot separator ('.') should be on the new line.
+
+Valid:
+````
+doSomething(alpha, beta,
+ gamma);
+doSomethingElse().stream()
+ .forEach(System.out::println);
+````
+
+Invalid:
+````
+doSomething(alpha, beta
+ , gamma);
+doSomethingElse().stream().
+ forEach(System.out::println);
+````
diff --git a/builder/src/main/resources/rules/SimpleAccessorNameNotation.md b/builder/src/main/resources/rules/SimpleAccessorNameNotation.md
new file mode 100644
index 0000000..5f2212c
--- /dev/null
+++ b/builder/src/main/resources/rules/SimpleAccessorNameNotation.md
@@ -0,0 +1,2 @@
+
+Checks that setters and getters follow the normal setField(), getField() and isField() pattern, where 'Field' is the name of the field being accessed.
diff --git a/builder/src/main/resources/rules/SimplifyBooleanExpression.md b/builder/src/main/resources/rules/SimplifyBooleanExpression.md
new file mode 100644
index 0000000..3ab6d91
--- /dev/null
+++ b/builder/src/main/resources/rules/SimplifyBooleanExpression.md
@@ -0,0 +1,15 @@
+
+Checks for overly complicated boolean expressions. Checks for code like `b == true`, `b || true`, `!false`, etc.
+
+Valid:
+````
+if (b) {}
+if (true) {}
+````
+
+Invalid:
+````
+if (b == true) {}
+if (b || true) {}
+if (!false) {}
+````
diff --git a/builder/src/main/resources/rules/SimplifyBooleanReturn.md b/builder/src/main/resources/rules/SimplifyBooleanReturn.md
new file mode 100644
index 0000000..4e782dc
--- /dev/null
+++ b/builder/src/main/resources/rules/SimplifyBooleanReturn.md
@@ -0,0 +1,16 @@
+
+Checks for overly complicated boolean `return` statements.
+
+Valid:
+````
+return !valid();
+````
+
+Invalid:
+````
+if (valid()) {
+ return false;
+} else {
+ return true;
+}
+````
diff --git a/builder/src/main/resources/rules/SingleBreakOrContinue.md b/builder/src/main/resources/rules/SingleBreakOrContinue.md
new file mode 100644
index 0000000..f3f8a8d
--- /dev/null
+++ b/builder/src/main/resources/rules/SingleBreakOrContinue.md
@@ -0,0 +1,2 @@
+
+Checks that there is at most one `continue` or `break` statement within a looping block (e.g. `for`, `while`, ...)
diff --git a/builder/src/main/resources/rules/SingleSpaceSeparator.md b/builder/src/main/resources/rules/SingleSpaceSeparator.md
new file mode 100644
index 0000000..69b6d06
--- /dev/null
+++ b/builder/src/main/resources/rules/SingleSpaceSeparator.md
@@ -0,0 +1,14 @@
+
+Checks that non-whitespace characters on the same line are separated by no more than one whitespace.
+
+Valid:
+````
+if (a < 0) {}
+public long toNanos(long d) { return d; };
+````
+
+Invalid:
+````
+if (a < 0) {}
+public long toNanos(long d) { return d; };
+````
diff --git a/builder/src/main/resources/rules/StaticVariableName.md b/builder/src/main/resources/rules/StaticVariableName.md
new file mode 100644
index 0000000..7276bdb
--- /dev/null
+++ b/builder/src/main/resources/rules/StaticVariableName.md
@@ -0,0 +1,4 @@
+
+Checks the format of `static`, non-`final` variable names.
+
+Identifiers must match `^[a-z][a-zA-Z0-9]*$`.
diff --git a/builder/src/main/resources/rules/StringLiteralEquality.md b/builder/src/main/resources/rules/StringLiteralEquality.md
new file mode 100644
index 0000000..7909cf4
--- /dev/null
+++ b/builder/src/main/resources/rules/StringLiteralEquality.md
@@ -0,0 +1,12 @@
+
+Checks that string literals are not used with `==` or `!=`.
+
+Valid:
+````
+if ("something".equals(x)) {}
+````
+
+Invalid:
+````
+if (x == "something") {}
+````
diff --git a/builder/src/main/resources/rules/SuppressWarnings.md b/builder/src/main/resources/rules/SuppressWarnings.md
new file mode 100644
index 0000000..0912bd2
--- /dev/null
+++ b/builder/src/main/resources/rules/SuppressWarnings.md
@@ -0,0 +1,12 @@
+
+Prevents the use of `@SuppressWarnings` for the following checks:
+
+* [ConstantName](#constantname)
+* [CovariantEquals](#covariantequals)
+* [EqualsHashCode](#equalshashcode)
+* [NoClone](#noclone)
+* [OneTopLevelClass](#onetoplevelclass)
+* [OuterTypeFilename](#outertypefilename)
+* [PackageDeclaration](#packagedeclaration)
+* [TypeName](#typename)
+* [VisibilityModifier](#visibilitymodifier)
diff --git a/builder/src/main/resources/rules/SuppressWarningsFilter.md b/builder/src/main/resources/rules/SuppressWarningsFilter.md
new file mode 100644
index 0000000..3bc1f3e
--- /dev/null
+++ b/builder/src/main/resources/rules/SuppressWarningsFilter.md
@@ -0,0 +1,2 @@
+
+Allows the use of the `@SuppressWarnings` annotation.
diff --git a/builder/src/main/resources/rules/SuppressWarningsHolder.md b/builder/src/main/resources/rules/SuppressWarningsHolder.md
new file mode 100644
index 0000000..ed7fd00
--- /dev/null
+++ b/builder/src/main/resources/rules/SuppressWarningsHolder.md
@@ -0,0 +1,2 @@
+
+Used by Checkstyle to hold the checks to be suppressed from `@SuppressWarnings(...)` annotations.
diff --git a/builder/src/main/resources/rules/TernaryPerExpressionCount.md b/builder/src/main/resources/rules/TernaryPerExpressionCount.md
new file mode 100644
index 0000000..97d1918
--- /dev/null
+++ b/builder/src/main/resources/rules/TernaryPerExpressionCount.md
@@ -0,0 +1,7 @@
+
+Checks that there is at most one ternary statments (`?:`) within an expression.
+
+Invalid:
+````
+String x = value != null ? "A" : "B" + value == null ? "C" : "D"
+````
diff --git a/builder/src/main/resources/rules/ThrowsCount.md b/builder/src/main/resources/rules/ThrowsCount.md
new file mode 100644
index 0000000..87018e6
--- /dev/null
+++ b/builder/src/main/resources/rules/ThrowsCount.md
@@ -0,0 +1,17 @@
+
+Restricts non-private methods to only `throws` 4 distinct Exception types. Exceptions should be hierarchical to allow catching suitable root Exceptions.
+
+See [Effective Java], 2nd Edition, Chapter 9: Exceptions
+
+Valid:
+````
+void doSomething() throws IllegalStateException, DowsingServiceException,
+ BalancedBudgetException, ManagementInterferanceException {}
+````
+
+Invalid:
+````
+void doSomething() throws IllegalStateException,
+ DowsingNotPermittedException, DowsingServiceNotReadyException,
+ BalancedBudgetException, ManagementInterferanceException {}
+````
diff --git a/builder/src/main/resources/rules/TodoComment.md b/builder/src/main/resources/rules/TodoComment.md
new file mode 100644
index 0000000..9275789
--- /dev/null
+++ b/builder/src/main/resources/rules/TodoComment.md
@@ -0,0 +1,2 @@
+
+Checks for remaining `TODO` and `FIXME` comments left in code. Their presence indicates that the program isn't finished yet.
diff --git a/builder/src/main/resources/rules/TrailingComment.md b/builder/src/main/resources/rules/TrailingComment.md
new file mode 100644
index 0000000..8ca7695
--- /dev/null
+++ b/builder/src/main/resources/rules/TrailingComment.md
@@ -0,0 +1,26 @@
+
+Checks for comments at the end of lines.
+
+Valid:
+````
+// comment on line by itself
+ // comment after white space
+if (a < 1) {
+ //
+} // comment on closing brace
+int[] a = new int[2](
+ 1, 2
+); // comment on closing parenthesis of statement
+````
+
+Invalid:
+````
+int a = 1; // comment in line with statement
+if (a < 1) { // comment on line with if statement
+ //
+}
+int[] a = new int[2](
+ 1, // first value - invalid comment
+ 2 // second value - also invalid comment
+);
+````
diff --git a/builder/src/main/resources/rules/Translation.md b/builder/src/main/resources/rules/Translation.md
new file mode 100644
index 0000000..a88a774
--- /dev/null
+++ b/builder/src/main/resources/rules/Translation.md
@@ -0,0 +1,2 @@
+
+Checks that all `messages*.properties` files all have the same set of keys.
diff --git a/builder/src/main/resources/rules/TypeName.md b/builder/src/main/resources/rules/TypeName.md
new file mode 100644
index 0000000..96e51a7
--- /dev/null
+++ b/builder/src/main/resources/rules/TypeName.md
@@ -0,0 +1,6 @@
+
+> This check cannot be suppressed.
+
+Checks the format of `class`, `interface`, `enum` identifiers, including annotations.
+
+Identifiers must match `^[A-Z][a-zA-Z0-9]*$`.
diff --git a/builder/src/main/resources/rules/TypecastParenPad.md b/builder/src/main/resources/rules/TypecastParenPad.md
new file mode 100644
index 0000000..f6cb182
--- /dev/null
+++ b/builder/src/main/resources/rules/TypecastParenPad.md
@@ -0,0 +1,14 @@
+
+Checks that there are no spaces within the typecasting parentheses.
+
+Valid:
+````
+String s = (String) list.get(2);
+````
+
+Invalid:
+````
+String s = (String ) list.get(2);
+String s = ( String) list.get(2);
+String s = ( String ) list.get(2);
+````
diff --git a/builder/src/main/resources/rules/UncommentedMain.md b/builder/src/main/resources/rules/UncommentedMain.md
new file mode 100644
index 0000000..c49f646
--- /dev/null
+++ b/builder/src/main/resources/rules/UncommentedMain.md
@@ -0,0 +1,2 @@
+
+Checks for `public static void main()` methods that may have been left over from testing. Allowed in classes whose names end in `Main` or `Application`.
diff --git a/builder/src/main/resources/rules/UniformEnumConstantName.md b/builder/src/main/resources/rules/UniformEnumConstantName.md
new file mode 100644
index 0000000..7e6a7c1
--- /dev/null
+++ b/builder/src/main/resources/rules/UniformEnumConstantName.md
@@ -0,0 +1,20 @@
+
+Checks that all the values of an `enum` follow the same naming pattern.
+
+Valid:
+````
+public enum EnumOne {
+ FirstElement, SecondElement, ThirdElement;
+}
+
+public enum EnumTwo {
+ FIRST_ELEMENT, SECOND_ELEMENT, THIRD_ELEMENT;
+}
+````
+
+Invalid:
+````
+public enum EnumThree {
+ FirstElement, SECOND_ELEMENT, ThirdElement;
+}
+````
diff --git a/builder/src/main/resources/rules/UniqueProperties.md b/builder/src/main/resources/rules/UniqueProperties.md
new file mode 100644
index 0000000..b05a11f
--- /dev/null
+++ b/builder/src/main/resources/rules/UniqueProperties.md
@@ -0,0 +1,2 @@
+
+Checks `*.properties` files for duplicate property keys.
diff --git a/builder/src/main/resources/rules/UnnecessaryParentheses.md b/builder/src/main/resources/rules/UnnecessaryParentheses.md
new file mode 100644
index 0000000..b00deb1
--- /dev/null
+++ b/builder/src/main/resources/rules/UnnecessaryParentheses.md
@@ -0,0 +1,12 @@
+
+Checks for the use of unnecessary parentheses.
+
+Valid:
+````
+if (a < 1) {}
+````
+
+Invalid:
+````
+if ((a < 1)) {}
+````
diff --git a/builder/src/main/resources/rules/UnusedImports.md b/builder/src/main/resources/rules/UnusedImports.md
new file mode 100644
index 0000000..40bcd9e
--- /dev/null
+++ b/builder/src/main/resources/rules/UnusedImports.md
@@ -0,0 +1,10 @@
+
+Checks for unused imports. Does not inspect wildcard imports, which should be blocked by [AvoidStarImport](#avoidstarimport) anyway.
+
+Imports are unused if:
+
+* They are not referenced in the file.
+* It duplicates another import.
+* It import from the `java.lang` package.
+* It imports a class from the same package.
+* It is only references from the Javadoc.
diff --git a/builder/src/main/resources/rules/UpperEll.md b/builder/src/main/resources/rules/UpperEll.md
new file mode 100644
index 0000000..1d51368
--- /dev/null
+++ b/builder/src/main/resources/rules/UpperEll.md
@@ -0,0 +1,12 @@
+
+Checks that `long` numeric literal values are marked by an upper-case ell ('L'). The lower-case ell ('l') can be mistaken for the numeral one ('1').
+
+Valid:
+````
+long id = 12345L;
+````
+
+Invalid:
+````
+long id = 12345l;
+````
diff --git a/builder/src/main/resources/rules/UselessSingleCatch.md b/builder/src/main/resources/rules/UselessSingleCatch.md
new file mode 100644
index 0000000..671e33e
--- /dev/null
+++ b/builder/src/main/resources/rules/UselessSingleCatch.md
@@ -0,0 +1,11 @@
+
+Checks for catch blocks that are useless. i.e. that catch al exceptions and then just rethrow them.
+
+Invalid:
+````
+try {
+ doSomething();
+} catch (Exception e) {
+ throw e;
+}
+````
diff --git a/builder/src/main/resources/rules/UselessSuperCtorCall.md b/builder/src/main/resources/rules/UselessSuperCtorCall.md
new file mode 100644
index 0000000..7435aa9
--- /dev/null
+++ b/builder/src/main/resources/rules/UselessSuperCtorCall.md
@@ -0,0 +1,16 @@
+
+Checks for useless calls the the `super()` method in constructors.
+
+Invalid:
+````
+class Dummy {
+ Dummy() {
+ super();
+ }
+}
+class Derived extends Base {
+ Derived() {
+ super();
+ }
+}
+````
\ No newline at end of file
diff --git a/builder/src/main/resources/rules/VariableDeclarationUsageDistance.md b/builder/src/main/resources/rules/VariableDeclarationUsageDistance.md
new file mode 100644
index 0000000..f5d7d30
--- /dev/null
+++ b/builder/src/main/resources/rules/VariableDeclarationUsageDistance.md
@@ -0,0 +1,4 @@
+
+Checks that a variable declaration and its first usage are not more than 3 lines. Blocks of initialisation methods don't count toward this total.
+
+See the official [Checkstyle documentation](http://checkstyle.sourceforge.net/config_coding.html#VariableDeclarationUsageDistance) for examples.
diff --git a/builder/src/main/resources/rules/VisibilityModifier.md b/builder/src/main/resources/rules/VisibilityModifier.md
new file mode 100644
index 0000000..1570456
--- /dev/null
+++ b/builder/src/main/resources/rules/VisibilityModifier.md
@@ -0,0 +1,72 @@
+
+> This check cannot be suppressed.
+
+Checks the visibility of class members to help enforce encapsulation. Only `static final` fields, immutable (see list below) fields or field with special annotation (see list below), may be public.
+
+The following are considered immutable when `final`, and can be `public`:
+
+* java.lang.String
+* java.lang.Integer
+* java.lang.Byte
+* java.lang.Character
+* java.lang.Short
+* java.lang.Boolean
+* java.lang.Long
+* java.lang.Double
+* java.lang.Float
+* java.lang.StackTraceElement
+* java.math.BigInteger
+* java.math.BigDecimal
+* java.io.File
+* java.util.Locale
+* java.util.UUID
+* java.net.URL
+* java.net.URI
+* java.net.Inet4Address
+* java.net.Inet6Address
+* java.net.InetSocketAddress
+
+Fields with the following annotations may be `public`:
+
+* org.junit.Rule
+* org.junit.ClassRule
+* com.google.common.annotations.VisibleForTesting
+
+Valid:
+````
+class Foo {
+
+ public final Long id;
+
+ public final String name;
+
+ private String description;
+
+ @VisibleForTesting
+ public State state;
+
+ Foo(final Long id, final String name) {
+ this.id = id;
+ this.name = name;
+ }
+}
+````
+
+Invalid:
+````
+class Foo {
+
+ public Long id;
+
+ public String name;
+
+ private String description;
+
+ public State state;
+
+ Foo(final Long id, final String name) {
+ this.id = id;
+ this.name = name;
+ }
+}
+````
diff --git a/builder/src/main/resources/rules/WhitespaceAfter.md b/builder/src/main/resources/rules/WhitespaceAfter.md
new file mode 100644
index 0000000..c833c04
--- /dev/null
+++ b/builder/src/main/resources/rules/WhitespaceAfter.md
@@ -0,0 +1,16 @@
+
+Checks that commas (','), statement terminators (';') and typecasts are all followed by a space.
+
+Valid:
+````
+doSomething(1, 2, 3);
+if (a > 1) { return true; }
+String name = (String) list.get(9);
+````
+
+Inalid:
+````
+doSomething(1,2,3);
+if (a > 1) { return true;}
+String name = (String)list.get(9);
+````
diff --git a/builder/src/main/resources/rules/WhitespaceAround.md b/builder/src/main/resources/rules/WhitespaceAround.md
new file mode 100644
index 0000000..dbdfec8
--- /dev/null
+++ b/builder/src/main/resources/rules/WhitespaceAround.md
@@ -0,0 +1,2 @@
+
+Checks that tokens are surrounded by whitespace.
\ No newline at end of file
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriterTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriterTest.java
new file mode 100644
index 0000000..2412652
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleWriterTest.java
@@ -0,0 +1,211 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import lombok.val;
+import me.andrz.builder.map.MapBuilder;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
+import org.mockito.MockitoAnnotations;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.AbstractMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for {@link CheckstyleWriter}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class CheckstyleWriterTest {
+
+ private static final String TEMPLATE = "C:%s\nTW:%s";
+
+ private CheckstyleWriter checkstyleWriter;
+
+ private OutputProperties outputProperties;
+
+ private TemplateProperties templateProperties;
+
+ private RulesProperties rulesProperties;
+
+ private String ruleName;
+
+ private Map outputFiles;
+
+ private Path outputDirectory;
+
+ private Path checkstyleTemplate;
+
+ @org.junit.Rule
+ public ExpectedException exception = ExpectedException.none();
+
+ @org.junit.Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ ruleName = UUID.randomUUID()
+ .toString();
+ outputProperties = new OutputProperties();
+ outputFiles = new MapBuilder().put(getOutputFile(RuleLevel.LAYOUT))
+ .put(getOutputFile(RuleLevel.NAMING))
+ .put(getOutputFile(RuleLevel.JAVADOC))
+ .put(getOutputFile(RuleLevel.TWEAKS))
+ .put(getOutputFile(RuleLevel.COMPLEXITY))
+ .build();
+ outputProperties.setRulesetFiles(outputFiles);
+ outputDirectory = folder.newFolder()
+ .toPath();
+ outputProperties.setDirectory(outputDirectory);
+ templateProperties = new TemplateProperties();
+ checkstyleTemplate = folder.newFile("checkstyle-template.xml")
+ .toPath();
+ Files.write(
+ checkstyleTemplate, TEMPLATE.getBytes(StandardCharsets.UTF_8), StandardOpenOption.TRUNCATE_EXISTING);
+ templateProperties.setCheckstyleXml(checkstyleTemplate);
+ rulesProperties = new RulesProperties();
+ checkstyleWriter = new CheckstyleWriter(outputProperties, templateProperties, rulesProperties);
+ }
+
+ // write rule that matches current level
+ @Test
+ public void writeRuleThatMatchesCurrentLevel() throws Exception {
+ //given
+ val rule = enabledRule(RuleLevel.LAYOUT, RuleParent.TREEWALKER);
+ rulesProperties.getRules()
+ .add(rule);
+ //when
+ checkstyleWriter.run();
+ //then
+ val lines = loadOutputFile(RuleLevel.LAYOUT);
+ assertThat(lines).containsExactly("C:", String.format("TW:", ruleName));
+ }
+
+ // write rule that is below current level
+ @Test
+ public void writeRuleThatIsBelowCurrentLevel() throws Exception {
+ //given
+ val rule = enabledRule(RuleLevel.LAYOUT, RuleParent.TREEWALKER);
+ rulesProperties.getRules()
+ .add(rule);
+ //when
+ checkstyleWriter.run();
+ //then
+ val lines = loadOutputFile(RuleLevel.NAMING);
+ assertThat(lines).containsExactly("C:", String.format("TW:", ruleName));
+ }
+
+ // write rule with checker parent
+ @Test
+ public void writeRuleWithCheckerParent() throws Exception {
+ //given
+ val rule = enabledRule(RuleLevel.LAYOUT, RuleParent.CHECKER);
+ rulesProperties.getRules()
+ .add(rule);
+ //when
+ checkstyleWriter.run();
+ //then
+ val lines = loadOutputFile(RuleLevel.LAYOUT);
+ assertThat(lines).containsExactly(String.format("C:", ruleName), "TW:");
+ }
+
+ // write rule with properties
+ @Test
+ public void writeRuleWithProperties() throws Exception {
+ //given
+ val rule = enabledRule(RuleLevel.LAYOUT, RuleParent.TREEWALKER);
+ rule.getProperties()
+ .put("key", "value");
+ rulesProperties.getRules()
+ .add(rule);
+ //when
+ checkstyleWriter.run();
+ //then
+ val lines = loadOutputFile(RuleLevel.LAYOUT);
+ assertThat(lines).containsExactly("C:", String.format("TW:", ruleName),
+ " ", ""
+ );
+ }
+
+ // ignore rule that is above current level
+ @Test
+ public void ignoreRuleThatIsAboveCurrentLevel() throws Exception {
+ //given
+ val rule = enabledRule(RuleLevel.NAMING, RuleParent.TREEWALKER);
+ rulesProperties.getRules()
+ .add(rule);
+ //when
+ checkstyleWriter.run();
+ //then
+ val lines = loadOutputFile(RuleLevel.LAYOUT);
+ assertThat(lines).containsExactly("C:", "TW:");
+ }
+
+ // ignore rule that has unspecified level
+ @Test
+ public void ignoreRuleThatHasUnspecifiedLevel() throws Exception {
+ //given
+ val rule = enabledRule(RuleLevel.UNSPECIFIED, RuleParent.TREEWALKER);
+ rulesProperties.getRules()
+ .add(rule);
+ //when
+ checkstyleWriter.run();
+ //then
+ val lines = loadOutputFile(RuleLevel.LAYOUT);
+ assertThat(lines).containsExactly("C:", "TW:");
+ }
+
+ // throw RTE if template not found
+ @Test
+ public void throwRteIfTemplateNotFound() throws Exception {
+ //given
+ templateProperties.setCheckstyleXml(Paths.get("garbage"));
+ exception.expect(RuntimeException.class);
+ exception.expectMessage("Missing template: garbage");
+ //when
+ checkstyleWriter.run();
+ }
+
+ // throw RTE if error writing file
+ @Test
+ public void throwRteIfErrorWritingFile() throws Exception {
+ //given
+ outputProperties.setDirectory(Paths.get("/../imaginary"));
+ exception.expect(RuntimeException.class);
+ exception.expectMessage("java.nio.file.NoSuchFileException: /../imaginary/checkstyle-LAYOUT.xml");
+ //when
+ checkstyleWriter.run();
+ }
+
+ private Map.Entry getOutputFile(final RuleLevel level) throws IOException {
+ final String xmlFile = String.format("checkstyle-%s.xml", level.toString());
+ return new AbstractMap.SimpleImmutableEntry<>(level, xmlFile);
+ }
+
+ private List loadOutputFile(final RuleLevel level) throws IOException {
+ val path = outputDirectory.resolve(outputFiles.get(level));
+ assertThat(path).as("Output path exists")
+ .exists();
+ return Files.readAllLines(path, StandardCharsets.UTF_8);
+ }
+
+ private Rule enabledRule(final RuleLevel level, final RuleParent parent) {
+ val rule = new Rule();
+ rule.setName(ruleName);
+ rule.setEnabled(true);
+ rule.setLevel(level);
+ rule.setParent(parent);
+ return rule;
+ }
+}
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/DefaultReadmeIndexBuilderTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/DefaultReadmeIndexBuilderTest.java
new file mode 100644
index 0000000..535fb4d
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/DefaultReadmeIndexBuilderTest.java
@@ -0,0 +1,65 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import lombok.val;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for {@link DefaultReadmeIndexBuilder}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class DefaultReadmeIndexBuilderTest {
+
+ private DefaultReadmeIndexBuilder indexBuilder;
+
+ private RulesProperties rulesProperties;
+
+ @Before
+ public void setUp() throws Exception {
+ rulesProperties = new RulesProperties();
+ indexBuilder = new DefaultReadmeIndexBuilder(rulesProperties);
+ }
+
+ @Test
+ public void createIndex() throws Exception {
+ //given
+ final List expectedIndexItems = new ArrayList<>(6);
+ expectedIndexItems.add("[a](#a)|layout|checkstyle|Yes|");
+ expectedIndexItems.add("[b](#b)|naming|sevntu||No");
+ expectedIndexItems.add("[c](#c)|javadoc|checkstyle|Yes|");
+ expectedIndexItems.add("[d](#d)|tweaks|checkstyle|Yes|");
+ expectedIndexItems.add("[e](#e)|complexity|checkstyle|Yes|");
+ expectedIndexItems.add("[f](#f)|unspecified|checkstyle|Yes|");
+ val rules = rulesProperties.getRules();
+ rules.add(rule("a", RuleLevel.LAYOUT, RuleSource.CHECKSTYLE, true, true));
+ rules.add(rule("b", RuleLevel.NAMING, RuleSource.SEVNTU, false, false));
+ rules.add(rule("c", RuleLevel.JAVADOC, RuleSource.CHECKSTYLE, true, true));
+ rules.add(rule("d", RuleLevel.TWEAKS, RuleSource.CHECKSTYLE, true, true));
+ rules.add(rule("e", RuleLevel.COMPLEXITY, RuleSource.CHECKSTYLE, true, true));
+ rules.add(rule("f", RuleLevel.UNSPECIFIED, RuleSource.CHECKSTYLE, true, true));
+ //when
+ val index = indexBuilder.build()
+ .split("\n");
+ //then
+ assertThat(index).containsExactlyElementsOf(expectedIndexItems);
+ }
+
+ private Rule rule(
+ final String name, final RuleLevel level, final RuleSource source, final boolean enabled,
+ final boolean supressible
+ ) {
+ val rule = new Rule();
+ rule.setName(name);
+ rule.setLevel(level);
+ rule.setSource(source);
+ rule.setEnabled(enabled);
+ rule.setInsuppressible(!supressible);
+ return rule;
+ }
+}
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/DefaultRuleReadmeLoaderTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/DefaultRuleReadmeLoaderTest.java
new file mode 100644
index 0000000..708d4d2
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/DefaultRuleReadmeLoaderTest.java
@@ -0,0 +1,84 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import lombok.val;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
+
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for {@link DefaultRuleReadmeLoader}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class DefaultRuleReadmeLoaderTest {
+
+ private RuleReadmeLoader loader;
+
+ private TemplateProperties templateProperties;
+
+ private Rule rule;
+
+ private Path fragment;
+
+ private Path fragments;
+
+ @org.junit.Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ @org.junit.Rule
+ public ExpectedException exception = ExpectedException.none();
+
+ @Before
+ public void setUp() throws Exception {
+ templateProperties = new TemplateProperties();
+ fragments = folder.newFolder("fragments")
+ .toPath();
+ templateProperties.setReadmeFragments(fragments);
+ loader = new DefaultRuleReadmeLoader(templateProperties);
+ rule = new Rule();
+ rule.setName("name");
+ rule.setUri(URI.create("uri"));
+ }
+
+ @Test
+ public void loadEnabledOkay() throws IOException {
+ //given
+ rule.setEnabled(true);
+ fragment = fragments.resolve("name.md");
+ Files.write(fragment, Arrays.asList("", "body"));
+ //when
+ val fragment = loader.load(rule);
+ //then
+ assertThat(fragment).containsExactlyElementsOf(Arrays.asList("#### [name](uri)", "", "body"));
+ }
+
+ @Test
+ public void loadEnabledWithMissingFragment() {
+ //given
+ rule.setEnabled(true);
+ exception.expect(ReadmeFragmentNotFoundException.class);
+ exception.expectMessage("name");
+ //when
+ loader.load(rule);
+ }
+
+ @Test
+ public void loadDisabled() {
+ //given
+ rule.setEnabled(false);
+ rule.setReason("reason");
+ //when
+ val fragment = loader.load(rule);
+ //then
+ assertThat(fragment).containsExactlyElementsOf(Arrays.asList("#### [name](uri)", "", "reason"));
+ }
+}
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/OutputPropertiesTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/OutputPropertiesTest.java
new file mode 100644
index 0000000..8ffd97c
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/OutputPropertiesTest.java
@@ -0,0 +1,48 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import lombok.val;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.nio.file.Paths;
+import java.util.HashMap;
+
+/**
+ * Tests for {@link OutputProperties}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class OutputPropertiesTest {
+
+ private OutputProperties outputProperties;
+
+ @Before
+ public void setUp() throws Exception {
+ outputProperties = new OutputProperties();
+ }
+
+ @Test
+ public void setAndGet() throws Exception {
+ //given
+ val directory = Paths.get("directory");
+ val rulesetFiles = new HashMap();
+ val readme = Paths.get("readme.md");
+ //when
+ outputProperties.setDirectory(directory);
+ outputProperties.setRulesetFiles(rulesetFiles);
+ outputProperties.setReadme(readme);
+ //then
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(outputProperties.getDirectory())
+ .as("set/getDirectory()")
+ .isEqualTo(directory);
+ softly.assertThat(outputProperties.getRulesetFiles())
+ .as("set/getRulesetFiles()")
+ .isEqualTo(rulesetFiles);
+ softly.assertThat(outputProperties.getReadme())
+ .as("set/getReadme()")
+ .isEqualTo(readme);
+ });
+ }
+}
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeFragmentNotFoundExceptionTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeFragmentNotFoundExceptionTest.java
new file mode 100644
index 0000000..7abfda9
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeFragmentNotFoundExceptionTest.java
@@ -0,0 +1,30 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import lombok.val;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for {@link ReadmeFragmentNotFoundException}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class ReadmeFragmentNotFoundExceptionTest {
+
+ @Test
+ public void shouldCreateExceptionWithName() {
+ //given
+ val name = "rule name";
+ val cause = new IOException();
+ //when
+ val exception = new ReadmeFragmentNotFoundException(name, cause);
+ //then
+ assertThat(exception.getMessage()).as("rule name is message")
+ .isEqualTo(name);
+ assertThat(exception.getCause()).as("cause is caught")
+ .isSameAs(cause);
+ }
+}
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java
new file mode 100644
index 0000000..f64ab97
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java
@@ -0,0 +1,102 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import lombok.val;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.BDDMockito.given;
+
+/**
+ * Tests for {@link ReadmeWriter}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class ReadmeWriterTest {
+
+ private ReadmeWriter readmeWriter;
+
+ private TemplateProperties templateProperties;
+
+ private OutputProperties outputProperties;
+
+ private RulesProperties rulesProperties;
+
+ @Mock
+ private RuleReadmeLoader ruleReadmeLoader;
+
+ @Mock
+ private ReadmeIndexBuilder indexBuilder;
+
+ private Path template;
+
+ private Path fragments;
+
+ private Path readme;
+
+ @org.junit.Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ template = folder.newFile("README-template.md")
+ .toPath();
+ Files.write(template, Arrays.asList("i:%s", "ce:%s", "se:%s", "cd:%s", "sd:%s"));
+ fragments = folder.newFolder("fragments")
+ .toPath();
+ readme = folder.newFile("README.md")
+ .toPath();
+ templateProperties = new TemplateProperties();
+ templateProperties.setReadmeTemplate(template);
+ templateProperties.setReadmeFragments(fragments);
+ outputProperties = new OutputProperties();
+ outputProperties.setReadme(readme);
+ rulesProperties = new RulesProperties();
+ readmeWriter =
+ new ReadmeWriter(templateProperties, outputProperties, rulesProperties, ruleReadmeLoader, indexBuilder);
+ }
+
+ @Test
+ public void createReadme() throws Exception {
+ //given
+ val expected = Arrays.asList("i:index", "ce:checkstyle-enabled", "se:sevntu-enabled", "cd:checkstyle-disabled",
+ "sd:sevntu-disabled"
+ );
+ val rules = rulesProperties.getRules();
+ final Rule checkstyleEnabled = rule(RuleSource.CHECKSTYLE, true);
+ final Rule checkstyleDisabled = rule(RuleSource.CHECKSTYLE, false);
+ final Rule sevntuEnabled = rule(RuleSource.SEVNTU, true);
+ final Rule sevntuDisabled = rule(RuleSource.SEVNTU, false);
+ rules.add(checkstyleEnabled);
+ rules.add(checkstyleDisabled);
+ rules.add(sevntuEnabled);
+ rules.add(sevntuDisabled);
+ given(indexBuilder.build()).willReturn("index");
+ given(ruleReadmeLoader.load(checkstyleEnabled)).willReturn(Stream.of("checkstyle-enabled"));
+ given(ruleReadmeLoader.load(checkstyleDisabled)).willReturn(Stream.of("checkstyle-disabled"));
+ given(ruleReadmeLoader.load(sevntuEnabled)).willReturn(Stream.of("sevntu-enabled"));
+ given(ruleReadmeLoader.load(sevntuDisabled)).willReturn(Stream.of("sevntu-disabled"));
+ //when
+ readmeWriter.run();
+ //then
+ final Stream lines = Files.lines(readme, StandardCharsets.UTF_8);
+ assertThat(lines).containsExactlyElementsOf(expected);
+ }
+
+ private Rule rule(final RuleSource source, final boolean enabled) {
+ val rule = new Rule();
+ rule.setSource(source);
+ rule.setEnabled(enabled);
+ return rule;
+ }
+}
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RuleParentTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RuleParentTest.java
new file mode 100644
index 0000000..3684c85
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RuleParentTest.java
@@ -0,0 +1,33 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import lombok.val;
+import org.junit.Test;
+
+import java.util.Arrays;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for {@link RuleParent}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class RuleParentTest {
+
+ @Test
+ public void valueOf() throws Exception {
+ assertThat(RuleParent.valueOf("CHECKER")).isEqualTo(RuleParent.CHECKER);
+ assertThat(RuleParent.valueOf("TREEWALKER")).isEqualTo(RuleParent.TREEWALKER);
+ }
+
+ @Test
+ public void values() throws Exception {
+ //given
+ val expected = Arrays.asList("CHECKER", "TREEWALKER");
+ //when
+ val values = Arrays.stream(RuleParent.values())
+ .map(RuleParent::toString);
+ //then
+ assertThat(values).containsExactlyElementsOf(expected);
+ }
+}
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RuleSourceTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RuleSourceTest.java
new file mode 100644
index 0000000..3cf5562
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RuleSourceTest.java
@@ -0,0 +1,33 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import lombok.val;
+import org.junit.Test;
+
+import java.util.Arrays;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for {@link RuleSource}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class RuleSourceTest {
+
+ @Test
+ public void valueOf() throws Exception {
+ assertThat(RuleSource.valueOf("CHECKSTYLE")).isEqualTo(RuleSource.CHECKSTYLE);
+ assertThat(RuleSource.valueOf("SEVNTU")).isEqualTo(RuleSource.SEVNTU);
+ }
+
+ @Test
+ public void values() throws Exception {
+ //given
+ val expected = Arrays.asList("CHECKSTYLE", "SEVNTU");
+ //when
+ val values = Arrays.stream(RuleSource.values())
+ .map(RuleSource::toString);
+ //then
+ assertThat(values).containsExactlyElementsOf(expected);
+ }
+}
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RuleTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RuleTest.java
new file mode 100644
index 0000000..8dd535c
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RuleTest.java
@@ -0,0 +1,79 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import lombok.val;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.net.URI;
+
+/**
+ * Tests for {@link Rule}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class RuleTest {
+
+ private Rule rule;
+
+ @Before
+ public void setUp() throws Exception {
+ rule = new Rule();
+ }
+
+ @Test
+ public void setAndGet() throws Exception {
+ //given
+ val name = "name";
+ val parent = RuleParent.TREEWALKER;
+ val level = RuleLevel.LAYOUT;
+ val source = RuleSource.CHECKSTYLE;
+ val enabled = true;
+ val insuppressible = true;
+ val uri = URI.create("rule://name.md");
+ val reason = "reason";
+ val key = "key";
+ val value = "value";
+ //when
+ rule.setName(name);
+ rule.setParent(parent);
+ rule.setLevel(level);
+ rule.setSource(source);
+ rule.setEnabled(enabled);
+ rule.setInsuppressible(insuppressible);
+ rule.setUri(uri);
+ rule.setReason(reason);
+ rule.getProperties()
+ .put(key, value);
+ //then
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(rule.getName())
+ .as("set/getName()")
+ .isEqualTo(name);
+ softly.assertThat(rule.getParent())
+ .as("set/getParent()")
+ .isEqualTo(parent);
+ softly.assertThat(rule.getLevel())
+ .as("set/getLevel()")
+ .isEqualTo(level);
+ softly.assertThat(rule.getSource())
+ .as("set/getSource()")
+ .isEqualTo(source);
+ softly.assertThat(rule.isEnabled())
+ .as("set/isEnabled()")
+ .isEqualTo(enabled);
+ softly.assertThat(rule.isInsuppressible())
+ .as("set/isInsuppressible()")
+ .isEqualTo(insuppressible);
+ softly.assertThat(rule.getUri())
+ .as("set/getUri()")
+ .isEqualTo(uri);
+ softly.assertThat(rule.getReason())
+ .as("set/getReason()")
+ .isEqualTo(reason);
+ softly.assertThat(rule.getProperties())
+ .as("getProperties()")
+ .containsEntry(key, value);
+ });
+ }
+}
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RulesPropertiesTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RulesPropertiesTest.java
new file mode 100644
index 0000000..119ce11
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/RulesPropertiesTest.java
@@ -0,0 +1,35 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for {@link RulesProperties}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class RulesPropertiesTest {
+
+ private RulesProperties rulesProperties;
+
+ @Before
+ public void setUp() throws Exception {
+ rulesProperties = new RulesProperties();
+ }
+
+ @Test
+ public void getEmpty() throws Exception {
+ assertThat(rulesProperties.getRules()).isEmpty();
+ }
+ @Test
+ public void getContent() throws Exception {
+ //given
+ final Rule rule = new Rule();
+ //when
+ rulesProperties.getRules().add(rule);
+ //then
+ assertThat(rulesProperties.getRules()).containsExactly(rule);
+ }
+}
diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/TemplatePropertiesTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/TemplatePropertiesTest.java
new file mode 100644
index 0000000..1b4e044
--- /dev/null
+++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/TemplatePropertiesTest.java
@@ -0,0 +1,47 @@
+package net.kemitix.checkstyle.ruleset.builder;
+
+import org.assertj.core.api.SoftAssertions;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * Tests for {@link TemplateProperties}.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public class TemplatePropertiesTest {
+
+ private TemplateProperties templateProperties;
+
+ @Before
+ public void setUp() throws Exception {
+ templateProperties = new TemplateProperties();
+ }
+
+ @Test
+ public void setAndGet() throws Exception {
+ //given
+ final Path checkstyleXml = Paths.get("checkstyle.xml");
+ final Path readmeTemplate = Paths.get("readme.md");
+ final Path readmeFragments = Paths.get("readme.dir");
+ //when
+ templateProperties.setCheckstyleXml(checkstyleXml);
+ templateProperties.setReadmeTemplate(readmeTemplate);
+ templateProperties.setReadmeFragments(readmeFragments);
+ //then
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(templateProperties.getCheckstyleXml())
+ .as("set/getCheckstyleXml()")
+ .isEqualTo(checkstyleXml);
+ softly.assertThat(templateProperties.getReadmeTemplate())
+ .as("set/getReadmeTemplate()")
+ .isEqualTo(readmeTemplate);
+ softly.assertThat(templateProperties.getReadmeFragments())
+ .as("set/getReadmeFragments()")
+ .isEqualTo(readmeFragments);
+ });
+ }
+}
diff --git a/plugin-sample/LICENSE.txt b/plugin-sample/LICENSE.txt
new file mode 100644
index 0000000..00c515a
--- /dev/null
+++ b/plugin-sample/LICENSE.txt
@@ -0,0 +1,23 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Paul Campbell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
diff --git a/plugin-sample/pom.xml b/plugin-sample/pom.xml
new file mode 100644
index 0000000..ff67a52
--- /dev/null
+++ b/plugin-sample/pom.xml
@@ -0,0 +1,43 @@
+
+
+
+ 4.0.0
+
+
+ net.kemitix
+ kemitix-checkstyle-ruleset-plugin-sample
+ 2.0.0
+
+
+ UTF-8
+ UTF-8
+
+
+
+
+
+ net.kemitix
+ kemitix-checkstyle-ruleset-maven-plugin
+ ${project.version}
+
+
+ validate
+
+ 2-naming
+
+
+
+
+
+
+
+
+
+ sevntu-maven
+ sevntu-maven
+ http://sevntu-checkstyle.github.io/sevntu.checkstyle/maven2
+
+
+
diff --git a/plugin-sample/src/main/java/net/kemitix/checkstyle/sample/Sample.java b/plugin-sample/src/main/java/net/kemitix/checkstyle/sample/Sample.java
new file mode 100644
index 0000000..9f7eaba
--- /dev/null
+++ b/plugin-sample/src/main/java/net/kemitix/checkstyle/sample/Sample.java
@@ -0,0 +1,38 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Paul Campbell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+package net.kemitix.checkstyle.sample;
+
+/**
+ * Sample class to test the Kemitix Checkstyle Ruleset Maven Plugin against.
+ *
+ * @author Paul Campbell (paul.campbell@hubio.com)
+ */
+public class Sample {
+
+
+ public static void main(String[] args) {
+ System.out.println("Sample!");
+ }
+}
diff --git a/plugin/LICENSE.txt b/plugin/LICENSE.txt
new file mode 100644
index 0000000..00c515a
--- /dev/null
+++ b/plugin/LICENSE.txt
@@ -0,0 +1,23 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Paul Campbell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
diff --git a/plugin/pom.xml b/plugin/pom.xml
new file mode 100644
index 0000000..3144f37
--- /dev/null
+++ b/plugin/pom.xml
@@ -0,0 +1,104 @@
+
+
+ 4.0.0
+
+
+ net.kemitix
+ kemitix-checkstyle-ruleset-parent
+ 2.0.0
+
+
+ kemitix-checkstyle-ruleset-maven-plugin
+ maven-plugin
+ Kemitix Checkstyle Ruleset Maven Plugin
+ Checkstyle configuration using the Kemitix Checkstyle Ruleset
+
+
+ 1.8
+ UTF-8
+ UTF-8
+ 3.3.9
+ 3.6.0
+ 3.5
+ 3.5
+ 2.2.0
+ 1.16.12
+ 1.0.0
+
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ ${maven.version}
+
+
+ org.apache.maven
+ maven-core
+ ${maven.version}
+
+
+ org.apache.maven.plugin-tools
+ maven-plugin-annotations
+ ${maven-plugin-annotations.version}
+ provided
+
+
+ org.twdata.maven
+ mojo-executor
+ ${mojo-executor.version}
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+ me.andrz
+ map-builder
+ ${map-builder.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-plugin-plugin
+ ${maven-plugin-plugin.version}
+
+
+ help-goal
+
+ helpmojo
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+
+ -Xlint:unchecked
+
+ true
+ true
+
+ 1.8
+
+
+
+
+
+
+ sevntu-maven
+ sevntu-maven
+ http://sevntu-checkstyle.github.io/sevntu.checkstyle/maven2
+
+
+
diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/AbstractCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/AbstractCheckMojo.java
new file mode 100644
index 0000000..cda8265
--- /dev/null
+++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/AbstractCheckMojo.java
@@ -0,0 +1,116 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Paul Campbell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+package net.kemitix.checkstyle.ruleset.plugin;
+
+import lombok.Setter;
+import lombok.val;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.BuildPluginManager;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.twdata.maven.mojoexecutor.MojoExecutor;
+
+/**
+ * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Ruleset.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+public abstract class AbstractCheckMojo extends AbstractMojo {
+
+ private static final String CHECKSTYLE_GROUPID = "com.puppycrawl.tools";
+
+ private static final String CHECKSTYLE_ARTIFACTID = "checkstyle";
+
+ private static final String SEVNTU_GROUPID = "com.github.sevntu.checkstyle";
+
+ private static final String SEVNTU_ARTIFACTID = "sevntu-checkstyle-maven-plugin";
+
+ private static final String KEMITIX_GROUPID = "net.kemitix";
+
+ private static final String KEMITIX_ARTIFACTID = "kemitix-checkstyle-ruleset";
+
+ private static final String APACHE_PLUGIN_GROUPID = "org.apache.maven.plugins";
+
+ private static final String APACHE_PLUGIN_ARTIFACTID = "maven-checkstyle-plugin";
+
+ private static final String CONFIG_LOCATION = "configLocation";
+
+ @Setter
+ @Parameter(defaultValue = "2.17")
+ private String mavenCheckstylePluginVersion;
+
+ @Setter
+ @Parameter(defaultValue = "7.3")
+ private String checkstyleVersion;
+
+ @Setter
+ @Parameter(defaultValue = "1.23.0")
+ private String sevntuVersion;
+
+ @Setter
+ @Parameter(defaultValue = "2.0.0")
+ private String rulesetVersion;
+
+ @Setter
+ @Parameter(defaultValue = "${project}", readonly = true)
+ private MavenProject mavenProject;
+
+ @Setter
+ @Parameter(defaultValue = "${session}", readonly = true)
+ private MavenSession mavenSession;
+
+ @Component
+ private BuildPluginManager pluginManager;
+
+ /**
+ * Execute Checkstyle Check.
+ *
+ * @param level The level of config file to use.
+ *
+ * @throws MojoExecutionException on execution error
+ * @throws MojoFailureException on execution failure
+ */
+ protected final void performCheck(final String level) throws MojoExecutionException, MojoFailureException {
+ val checkstyle = MojoExecutor.dependency(CHECKSTYLE_GROUPID, CHECKSTYLE_ARTIFACTID, checkstyleVersion);
+ val sevntu = MojoExecutor.dependency(SEVNTU_GROUPID, SEVNTU_ARTIFACTID, sevntuVersion);
+ val ruleset = MojoExecutor.dependency(KEMITIX_GROUPID, KEMITIX_ARTIFACTID, rulesetVersion);
+ val checkstylePlugin =
+ MojoExecutor.plugin(APACHE_PLUGIN_GROUPID, APACHE_PLUGIN_ARTIFACTID, mavenCheckstylePluginVersion,
+ MojoExecutor.dependencies(checkstyle, sevntu, ruleset)
+ );
+ val configLocation =
+ MojoExecutor.element(CONFIG_LOCATION, String.format("net/kemitix/checkstyle-%s.xml", level));
+
+ getLog().info(
+ String.format("Running Checkstyle %s (sevntu: %s) with %s", checkstyleVersion, sevntuVersion, level));
+ MojoExecutor.executeMojo(checkstylePlugin, "check", MojoExecutor.configuration(configLocation),
+ MojoExecutor.executionEnvironment(mavenProject, mavenSession, pluginManager)
+ );
+ }
+}
diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/ComplexityCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/ComplexityCheckMojo.java
new file mode 100644
index 0000000..94090c8
--- /dev/null
+++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/ComplexityCheckMojo.java
@@ -0,0 +1,44 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Paul Campbell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+package net.kemitix.checkstyle.ruleset.plugin;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+
+/**
+ * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Ruleset: COMPLEXITY, TWEAKS, JAVADOC, NAMING and LAYOUT.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+@Mojo(name = "5-complexity", defaultPhase = LifecyclePhase.VALIDATE)
+public class ComplexityCheckMojo extends AbstractCheckMojo {
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ performCheck("5-complexity");
+ }
+}
diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/JavadocCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/JavadocCheckMojo.java
new file mode 100644
index 0000000..2952110
--- /dev/null
+++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/JavadocCheckMojo.java
@@ -0,0 +1,44 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Paul Campbell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+package net.kemitix.checkstyle.ruleset.plugin;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+
+/**
+ * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Ruleset: JAVADOC, NAMING and LAYOUT.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+@Mojo(name = "3-javadoc", defaultPhase = LifecyclePhase.VALIDATE)
+public class JavadocCheckMojo extends AbstractCheckMojo {
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ performCheck("3-javadoc");
+ }
+}
diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/LayoutCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/LayoutCheckMojo.java
new file mode 100644
index 0000000..e6aee8e
--- /dev/null
+++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/LayoutCheckMojo.java
@@ -0,0 +1,44 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Paul Campbell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+package net.kemitix.checkstyle.ruleset.plugin;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+
+/**
+ * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Ruleset: LAYOUT.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+@Mojo(name = "1-layout", defaultPhase = LifecyclePhase.VALIDATE)
+public class LayoutCheckMojo extends AbstractCheckMojo {
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ performCheck("1-layout");
+ }
+}
diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/NamingCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/NamingCheckMojo.java
new file mode 100644
index 0000000..a650885
--- /dev/null
+++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/NamingCheckMojo.java
@@ -0,0 +1,44 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Paul Campbell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+package net.kemitix.checkstyle.ruleset.plugin;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+
+/**
+ * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Rulesets: NAMING and LAYOUT.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+@Mojo(name = "2-naming", defaultPhase = LifecyclePhase.VALIDATE)
+public class NamingCheckMojo extends AbstractCheckMojo {
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ performCheck("2-naming");
+ }
+}
diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/TweaksCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/TweaksCheckMojo.java
new file mode 100644
index 0000000..6cb2144
--- /dev/null
+++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/TweaksCheckMojo.java
@@ -0,0 +1,44 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Paul Campbell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+package net.kemitix.checkstyle.ruleset.plugin;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+
+/**
+ * Runs the Checkstyle Maven Plugin with the Kemitix Checkstyle Ruleset: TWEAKS, JAVADOC, NAMING and LAYOUT.
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+@Mojo(name = "4-tweaks", defaultPhase = LifecyclePhase.VALIDATE)
+public class TweaksCheckMojo extends AbstractCheckMojo {
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ performCheck("4-tweaks");
+ }
+}
diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/package-info.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/package-info.java
new file mode 100644
index 0000000..af77c05
--- /dev/null
+++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/package-info.java
@@ -0,0 +1,31 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Paul Campbell
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/**
+ * .
+ *
+ * @author Paul Campbell (pcampbell@kemitix.net)
+ */
+
+package net.kemitix.checkstyle.ruleset.plugin;
diff --git a/pom.xml b/pom.xml
index 43eaa15..55f63be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,12 +5,24 @@
4.0.0
net.kemitix
- kemitix-checkstyle-ruleset
- 1.0.0
- jar
+ kemitix-checkstyle-ruleset-parent
+ 2.0.0
+ pom
- Kemitix Checkstyle Ruleset
- Checkstyle Ruleset for use by packages derived from kemitix-parent
+ Kemitix Checkstyle Ruleset (Parent)
+ Parent POM for the Kemitix Checkstyle Ruleset and it's Builder
+
+
+ UTF-8
+ UTF-8
+
+
+
+ builder
+ ruleset
+ plugin
+ plugin-sample
+
https://github.com/kemitix/kemitix-checkstyle-ruleset/issues
@@ -46,89 +58,4 @@
https://github.com/kemitix/
-
-
- 2.10.4
- 3.0.1
- 1.6
- 2.8.2
-
-
-
-
- release
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- ${maven-javadoc-plugin.version}
-
-
- attach-javadocs
- verify
-
- jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- ${maven-source-plugin.version}
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- ${maven-gpg-plugin.version}
-
- ${gpg.passphrase}
-
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
- ${maven-deploy-plugin.version}
-
-
-
-
-
-
-
-
- sonatype-nexus-snapshots
- Sonatype Nexus Snapshots
- https://oss.sonatype.org/content/repositories/snapshots/
-
-
- sonatype-nexus-staging
- Nexus Release Repository
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
-
diff --git a/ruleset/pom.xml b/ruleset/pom.xml
new file mode 100644
index 0000000..f4a6200
--- /dev/null
+++ b/ruleset/pom.xml
@@ -0,0 +1,96 @@
+
+
+ 4.0.0
+
+
+ net.kemitix
+ kemitix-checkstyle-ruleset-parent
+ 2.0.0
+
+
+ kemitix-checkstyle-ruleset
+ 2.0.0
+ jar
+
+ Kemitix Checkstyle Ruleset
+ Checkstyle Ruleset for use by packages derived from kemitix-parent
+
+
+
+ release
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${maven-javadoc-plugin.version}
+
+
+ attach-javadocs
+ verify
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ attach-sources
+ verify
+
+ jar-no-fork
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ ${maven-gpg-plugin.version}
+
+ ${gpg.passphrase}
+
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ ${maven-deploy-plugin.version}
+
+
+
+
+
+
+
+
+ sonatype-nexus-snapshots
+ Sonatype Nexus Snapshots
+ https://oss.sonatype.org/content/repositories/snapshots/
+
+
+ sonatype-nexus-staging
+ Nexus Release Repository
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+
diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml
new file mode 100644
index 0000000..72c0d46
--- /dev/null
+++ b/ruleset/src/main/resources/net/kemitix/checkstyle-1-layout.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml
new file mode 100644
index 0000000..d27be47
--- /dev/null
+++ b/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml
new file mode 100644
index 0000000..1fe56af
--- /dev/null
+++ b/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml
new file mode 100644
index 0000000..cf4ce72
--- /dev/null
+++ b/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml
new file mode 100644
index 0000000..44de9aa
--- /dev/null
+++ b/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml
@@ -0,0 +1,230 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/net/kemitix/checkstyle.xml b/ruleset/src/main/resources/net/kemitix/checkstyle.xml
similarity index 100%
rename from src/main/resources/net/kemitix/checkstyle.xml
rename to ruleset/src/main/resources/net/kemitix/checkstyle.xml