You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2016/11/26 12:08:26 UTC
[01/11] isis git commit: ISIS-1538: updates simpleapp to use
mavenmixin's
Repository: isis
Updated Branches:
refs/heads/maint-1.13.2 48fece9b8 -> f63e38ae6
ISIS-1538: updates simpleapp to use mavenmixin's
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/64bbed4a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/64bbed4a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/64bbed4a
Branch: refs/heads/maint-1.13.2
Commit: 64bbed4ab29bf0a3dddf09382af90b3071611834
Parents: 48fece9
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Nov 24 07:54:53 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 24 07:54:53 2016 +0000
----------------------------------------------------------------------
.../application/simpleapp/application/pom.xml | 10 +
.../simpleapp/modules/checkstyle.xml | 287 +++++++
.../simpleapp/modules/module-simple/pom.xml | 26 +
.../simpleapp/modules/pmd-rulesets/basic.xml | 807 +++++++++++++++++++
.../simpleapp/modules/pmd-rulesets/imports.xml | 145 ++++
.../modules/pmd-rulesets/rulesets.properties | 1 +
.../modules/pmd-rulesets/unusedcode.xml | 125 +++
example/application/simpleapp/modules/pmd.xml | 46 ++
example/application/simpleapp/pom.xml | 94 ---
example/application/simpleapp/webapp/pom.xml | 18 +
10 files changed, 1465 insertions(+), 94 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/64bbed4a/example/application/simpleapp/application/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/application/pom.xml b/example/application/simpleapp/application/pom.xml
index ea09bea..aab34cd 100644
--- a/example/application/simpleapp/application/pom.xml
+++ b/example/application/simpleapp/application/pom.xml
@@ -76,6 +76,16 @@
<mixins>
<mixin>
<groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>standard</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>enforcerrelaxed</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
<artifactId>surefire</artifactId>
<version>0.0.2</version>
</mixin>
http://git-wip-us.apache.org/repos/asf/isis/blob/64bbed4a/example/application/simpleapp/modules/checkstyle.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/checkstyle.xml b/example/application/simpleapp/modules/checkstyle.xml
new file mode 100644
index 0000000..033c545
--- /dev/null
+++ b/example/application/simpleapp/modules/checkstyle.xml
@@ -0,0 +1,287 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
+
+<!--
+
+ Checkstyle configuration that checks the sun coding conventions from:
+
+ - the Java Language Specification at
+ http://java.sun.com/docs/books/jls/second_edition/html/index.html
+
+ - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+
+ - the Javadoc guidelines at
+ http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+
+ - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+
+ - some best practices
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.sf.net (or in your downloaded distribution).
+
+ Most Checks are configurable, be sure to consult the documentation.
+
+ To completely disable a check, just comment it out or delete it from the file.
+
+ Finally, it is worth reading the documentation.
+
+-->
+
+<module name="Checker">
+
+ <!-- Checks that a package.html file exists for each package. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
+ <module name="JavadocPackage"/>
+ <!--
+ -->
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+ <!--
+ <module name="NewlineAtEndOfFile"/>
+ -->
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+ <module name="Translation"/>
+
+ <!--
+ eg:
+ //CHECKSTYLE.OFF: IllegalCatch - Much more readable than catching 7 exceptions
+ catch (Exception e)
+ //CHECKSTYLE.ON: IllegalCatch
+ -->
+ <module name="SuppressionCommentFilter">
+ <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
+ <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
+ <property name="checkFormat" value="$1"/>
+ </module>
+
+ <!--
+ eg:
+ // CHECKSTYLE IGNORE check FOR NEXT 1 LINES
+ public void onClick(View view) { ... } -->
+ <module name="SuppressWithNearbyCommentFilter">
+ <property name="commentFormat" value="CHECKSTYLE.IGNORE (\w+) FOR NEXT (\d+) LINES"/>
+ <property name="checkFormat" value="$1"/>
+ <property name="influenceFormat" value="$2"/>
+ </module>
+
+ <module name="TreeWalker">
+
+ <property name="cacheFile" value="${checkstyle.cache.file}"/>
+
+ <!-- not available in eclipse-cs
+ <module name="JavadocDeprecated"/>
+ -->
+ <module name="MissingOverride"/>
+
+ <!-- ************************************************************** -->
+ <!-- Checks that are different from the sun coding conventions ones -->
+ <!-- ************************************************************** -->
+ <property name="tabWidth" value="4"/>
+ <module name="LeftCurly">
+ <property name="option" value="eol"/>
+ </module>
+ <module name="RightCurly">
+ <property name="option" value="same"/>
+ </module>
+ <module name="MemberName">
+ <property name="format" value="^[a-z]([a-zA-Z0-9])*$"/>
+ </module>
+ <module name="StaticVariableName">
+ <property name="format" value="^[A-Z](_?[A-Z0-9])*$"/>
+ </module>
+ <module name="MethodName">
+ <property name="format" value="[a-z](_?[a-zA-Z0-9]+)*$"/>
+ </module>
+ <module name="ParameterName">
+ <property name="format" value="[a-z]([a-zA-Z0-9]+)*$"/>
+ </module>
+ <module name="LocalVariableName">
+ <property name="format" value="[a-z]([a-zA-Z0-9]+)*$"/>
+ </module>
+
+ <!-- ************************************************************** -->
+ <!-- Default Sun coding conventions checks -->
+ <!-- ************************************************************** -->
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+
+ <!-- TODO: instate at some point (though only for public methods
+ <module name="JavadocType"/>
+ -->
+ <!--
+ <module name="JavadocMethod"/>
+ <module name="JavadocVariable"/>
+ -->
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName"/>
+ <module name="PackageName"/>
+ <module name="TypeName"/>
+ <module name="LocalFinalVariableName"/>
+
+
+ <!-- Checks for Headers -->
+ <!-- See http://checkstyle.sf.net/config_header.html -->
+ <!--
+ <module name="Header">
+ -->
+ <!-- The follow property value demonstrates the ability -->
+ <!-- to have access to ANT properties. In this case it uses -->
+ <!-- the ${basedir} property to allow Checkstyle to be run -->
+ <!-- from any directory within a project. -->
+ <!--
+ <property name="headerFile" value="${checkstyle.header.file}"/>
+ </module>
+ -->
+
+ <!-- Following interprets the header file as regular expressions. -->
+ <!-- <module name="RegexpHeader"/> -->
+
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport"/>
+ <module name="IllegalImport"/>
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="EmptyBlock"/>
+ <module name="NeedBraces"/>
+ <!--
+ <module name="AvoidNestedBlocks"/>
+ -->
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <module name="EmptyStatement"/>
+ <module name="MagicNumber"/>
+ <module name="MissingSwitchDefault"/>
+ <module name="RedundantThrows"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+
+ <!-- not supported in maven
+ <module name="DoubleCheckedLocking"/>
+ -->
+ <!--
+ <module name="AvoidInlineConditionals"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField"/>
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+ -->
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!--
+
+ <module name="VisibilityModifier"/>
+ -->
+ <!-- too many violations...
+ <module name="DesignForExtension"/>
+ -->
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ <module name="InterfaceIsType"/>
+
+
+ <module name="CyclomaticComplexity">
+ <property name="max" value="12"/>
+ </module>
+ <module name="NPathComplexity">
+ <property name="max" value="160"/>
+ </module>
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <!--
+ <module name="ArrayTypeStyle"/>
+ <module name="GenericIllegalRegexp">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+ -->
+ <!-- removed; we detect these in other ways.
+ <module name="TodoComment"/>
+ -->
+ <module name="UpperEll"/>
+ <module name="FinalParameters"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <!--
+ <module name="NoWhitespaceAfter"/>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+ <module name="TabCharacter"/>
+ -->
+ <module name="EmptyForIteratorPad"/>
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <!--
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+ -->
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="LineLength">
+ <property name="max" value="120"/>
+ </module>
+ <module name="MethodLength">
+ <property name="max" value="30"/>
+ </module>
+ <module name="ParameterNumber">
+ <property name="max" value="6"/>
+ </module>
+
+ </module>
+
+
+
+ <module name="FileLength">
+ <property name="max" value="1500"/>
+ </module>
+
+ <module name="FileTabCharacter">
+ <property name="eachLine" value="true"/>
+ <property name="fileExtensions" value="java,xml"/>
+ </module>
+
+</module>
http://git-wip-us.apache.org/repos/asf/isis/blob/64bbed4a/example/application/simpleapp/modules/module-simple/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/module-simple/pom.xml b/example/application/simpleapp/modules/module-simple/pom.xml
index e84c778..ff125fc 100644
--- a/example/application/simpleapp/modules/module-simple/pom.xml
+++ b/example/application/simpleapp/modules/module-simple/pom.xml
@@ -73,6 +73,16 @@
<mixins>
<mixin>
<groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>standard</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>enforcerrelaxed</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
<artifactId>datanucleusenhance</artifactId>
<version>0.0.2</version>
</mixin>
@@ -86,6 +96,16 @@
<artifactId>surefire</artifactId>
<version>0.0.2</version>
</mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>sourceandjavadoc</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>staticanalysis</artifactId>
+ <version>0.0.1</version>
+ </mixin>
</mixins>
</configuration>
</plugin>
@@ -96,6 +116,12 @@
<danhaywood-mavenmixin-isisvalidate>
domainapp.modules.simple.SimpleModuleManifest
</danhaywood-mavenmixin-isisvalidate>
+ <danhaywood-mavenmixin-staticanalysis.checkstyle.configLocation>
+ ${project.basedir}/../checkstyle.xml
+ </danhaywood-mavenmixin-staticanalysis.checkstyle.configLocation>
+ <danhaywood-mavenmixin-staticanalysis.pmd.ruleset>
+ ${project.basedir}/../pmd.xml
+ </danhaywood-mavenmixin-staticanalysis.pmd.ruleset>
</properties>
<dependencies>
http://git-wip-us.apache.org/repos/asf/isis/blob/64bbed4a/example/application/simpleapp/modules/pmd-rulesets/basic.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/pmd-rulesets/basic.xml b/example/application/simpleapp/modules/pmd-rulesets/basic.xml
new file mode 100644
index 0000000..f18af2c
--- /dev/null
+++ b/example/application/simpleapp/modules/pmd-rulesets/basic.xml
@@ -0,0 +1,807 @@
+<?xml version="1.0"?>
+
+<ruleset name="Basic"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+ <description>
+The Basic ruleset contains a collection of good practices which should be followed.
+ </description>
+
+ <rule name="JumbledIncrementer"
+ language="java"
+ since="1.0"
+ message="Avoid modifying an outer loop incrementer in an inner loop for update expression"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#JumbledIncrementer">
+ <description>
+Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ForStatement
+ [
+ ForUpdate/StatementExpressionList/StatementExpression/PostfixExpression/PrimaryExpression/PrimaryPrefix/Name/@Image
+ =
+ ancestor::ForStatement/ForInit//VariableDeclaratorId/@Image
+ ]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class JumbledIncrementerRule1 {
+ public void foo() {
+ for (int i = 0; i < 10; i++) { // only references 'i'
+ for (int k = 0; k < 20; i++) { // references both 'i' and 'k'
+ System.out.println("Hello");
+ }
+ }
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ForLoopShouldBeWhileLoop"
+ language="java"
+ since="1.02"
+ message="This for loop could be simplified to a while loop"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ForLoopShouldBeWhileLoop">
+ <description>
+Some for loops can be simplified to while loops, this makes them more concise.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ForStatement
+ [count(*) > 1]
+ [not(LocalVariableDeclaration)]
+ [not(ForInit)]
+ [not(ForUpdate)]
+ [not(Type and Expression and Statement)]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ void bar() {
+ for (;true;) true; // No Init or Update part, may as well be: while (true)
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="OverrideBothEqualsAndHashcode"
+ language="java"
+ since="0.4"
+ message="Ensure you override both equals() and hashCode()"
+ class="net.sourceforge.pmd.lang.java.rule.basic.OverrideBothEqualsAndHashcodeRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#OverrideBothEqualsAndHashcode">
+ <description>
+Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public class Bar { // poor, missing a hashcode() method
+ public boolean equals(Object o) {
+ // do some comparison
+ }
+}
+
+public class Baz { // poor, missing an equals() method
+ public int hashCode() {
+ // return some hash value
+ }
+}
+
+public class Foo { // perfect, both methods provided
+ public boolean equals(Object other) {
+ // do some comparison
+ }
+ public int hashCode() {
+ // return some hash value
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="DoubleCheckedLocking"
+ language="java"
+ since="1.04"
+ message="Double checked locking is not thread safe in Java."
+ class="net.sourceforge.pmd.lang.java.rule.basic.DoubleCheckedLockingRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#DoubleCheckedLocking">
+ <description>
+Partially created objects can be returned by the Double Checked Locking pattern when used in Java.
+An optimizing JRE may assign a reference to the baz variable before it creates the object the
+reference is intended to point to.
+
+For more details refer to: http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html
+ </description>
+ <priority>1</priority>
+ <example>
+ <![CDATA[
+public class Foo {
+ Object baz;
+ Object bar() {
+ if (baz == null) { // baz may be non-null yet not fully created
+ synchronized(this) {
+ if (baz == null) {
+ baz = new Object();
+ }
+ }
+ }
+ return baz;
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ReturnFromFinallyBlock"
+ language="java"
+ since="1.05"
+ message="Avoid returning from a finally block"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ReturnFromFinallyBlock">
+ <description>
+Avoid returning from a finally block, this can discard exceptions.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//FinallyStatement//ReturnStatement
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Bar {
+ public String foo() {
+ try {
+ throw new Exception( "My Exception" );
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ return "A. O. K."; // return not recommended here
+ }
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnconditionalIfStatement"
+ language="java"
+ since="1.5"
+ message="Do not use 'if' statements that are always true or always false"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#UnconditionalIfStatement">
+ <description>
+Do not use "if" statements whose conditionals are always true or always false.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//IfStatement/Expression
+ [count(PrimaryExpression)=1]
+ /PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ public void close() {
+ if (true) { // fixed conditional, not recommended
+ // ...
+ }
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="BooleanInstantiation"
+ since="1.2"
+ message="Avoid instantiating Boolean objects; reference Boolean.TRUE or Boolean.FALSE or call Boolean.valueOf() instead."
+ class="net.sourceforge.pmd.lang.java.rule.basic.BooleanInstantiationRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#BooleanInstantiation">
+ <description>
+Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boolean.valueOf() instead.
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+Boolean bar = new Boolean("true"); // unnecessary creation, just reference Boolean.TRUE;
+Boolean buz = Boolean.valueOf(false); // ...., just reference Boolean.FALSE;
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="CollapsibleIfStatements"
+ language="java"
+ since="3.1"
+ message="These nested if statements could be combined"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#CollapsibleIfStatements">
+ <description>
+Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//IfStatement[@Else='false']/Statement
+ /IfStatement[@Else='false']
+ |
+//IfStatement[@Else='false']/Statement
+ /Block[count(BlockStatement)=1]/BlockStatement
+ /Statement/IfStatement[@Else='false']]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+void bar() {
+ if (x) { // original implementation
+ if (y) {
+ // do stuff
+ }
+ }
+}
+
+void bar() {
+ if (x && y) { // optimized implementation
+ // do stuff
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ClassCastExceptionWithToArray"
+ language="java"
+ since="3.4"
+ message="This usage of the Collection.toArray() method will throw a ClassCastException."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ClassCastExceptionWithToArray">
+ <description>
+When deriving an array of a specific class from your Collection, one should provide an array of
+the same class as the parameter of the toArray() method. Doing otherwise you will will result
+in a ClassCastException.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//CastExpression[Type/ReferenceType/ClassOrInterfaceType[@Image !=
+"Object"]]/PrimaryExpression
+[
+ PrimaryPrefix/Name[ends-with(@Image, '.toArray')]
+ and
+ PrimarySuffix/Arguments[count(*) = 0]
+and
+count(PrimarySuffix) = 1
+]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+Collection c = new ArrayList();
+Integer obj = new Integer(1);
+c.add(obj);
+
+ // this would trigger the rule (and throw a ClassCastException if executed)
+Integer[] a = (Integer [])c.toArray();
+
+ // this is fine and will not trigger the rule
+Integer[] b = (Integer [])c.toArray(new Integer[c.size()]);
+]]>
+ </example>
+</rule>
+
+
+<rule name="AvoidDecimalLiteralsInBigDecimalConstructor"
+ language="java"
+ since="3.4"
+ message="Avoid creating BigDecimal with a decimal (float/double) literal. Use a String literal"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidDecimalLiteralsInBigDecimalConstructor">
+ <description>
+One might assume that the result of "new BigDecimal(0.1)" is exactly equal to 0.1, but it is actually
+equal to .1000000000000000055511151231257827021181583404541015625.
+This is because 0.1 cannot be represented exactly as a double (or as a binary fraction of any finite
+length). Thus, the long value that is being passed in to the constructor is not exactly equal to 0.1,
+appearances notwithstanding.
+
+The (String) constructor, on the other hand, is perfectly predictable: 'new BigDecimal("0.1")' is
+exactly equal to 0.1, as one would expect. Therefore, it is generally recommended that the
+(String) constructor be used in preference to this one.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//AllocationExpression[ClassOrInterfaceType[@Image="BigDecimal"]
+and
+./Arguments/ArgumentList
+/Expression/PrimaryExpression/PrimaryPrefix/Literal[(not
+(ends-with
+(@Image,'"'))) and contains(@Image,".")]]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+BigDecimal bd = new BigDecimal(1.123); // loss of precision, this would trigger the rule
+
+BigDecimal bd = new BigDecimal("1.123"); // preferred approach
+
+BigDecimal bd = new BigDecimal(12); // preferred approach, ok for integer values
+]]>
+ </example>
+</rule>
+
+
+ <rule name="MisplacedNullCheck"
+ language="java"
+ since="3.5"
+ message="The null check here is misplaced; if the variable is null there'll be a NullPointerException"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#MisplacedNullCheck">
+ <description>
+The null check here is misplaced. If the variable is null a NullPointerException will be thrown.
+Either the check is useless (the variable will never be "null") or it is incorrect.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//Expression
+ /*[self::ConditionalOrExpression or self::ConditionalAndExpression]
+ /descendant::PrimaryExpression/PrimaryPrefix
+ /Name[starts-with(@Image,
+ concat(ancestor::PrimaryExpression/following-sibling::EqualityExpression
+ [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
+ /PrimaryExpression/PrimaryPrefix
+ /Name[count(../../PrimarySuffix)=0]/@Image,".")
+ )
+ ]
+ [count(ancestor::ConditionalAndExpression/EqualityExpression
+ [@Image='!=']
+ [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
+ [starts-with(following-sibling::*/PrimaryExpression/PrimaryPrefix/Name/@Image,
+ concat(./PrimaryExpression/PrimaryPrefix/Name/@Image, '.'))]
+ ) = 0
+ ]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ void bar() {
+ if (a.equals(baz) && a != null) {}
+ }
+}
+ ]]>
+ </example>
+ <example><![CDATA[
+public class Foo {
+ void bar() {
+ if (a.equals(baz) || a == null) {}
+ }
+}
+ ]]></example>
+ </rule>
+
+
+ <rule name="AvoidThreadGroup"
+ language="java"
+ since="3.6"
+ message="Avoid using java.lang.ThreadGroup; it is not thread safe"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidThreadGroup"
+ typeResolution="true">
+ <description>
+Avoid using java.lang.ThreadGroup; although it is intended to be used in a threaded environment
+it contains methods that are not thread-safe.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//AllocationExpression/ClassOrInterfaceType[pmd-java:typeof(@Image, 'java.lang.ThreadGroup')]|
+//PrimarySuffix[contains(@Image, 'getThreadGroup')]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Bar {
+ void buz() {
+ ThreadGroup tg = new ThreadGroup("My threadgroup") ;
+ tg = new ThreadGroup(tg, "my thread group");
+ tg = Thread.currentThread().getThreadGroup();
+ tg = System.getSecurityManager().getThreadGroup();
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="BrokenNullCheck"
+ since="3.8"
+ message="Method call on object which may be null"
+ class="net.sourceforge.pmd.lang.java.rule.basic.BrokenNullCheckRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#BrokenNullCheck">
+ <description>
+The null check is broken since it will throw a NullPointerException itself.
+It is likely that you used || instead of && or vice versa.
+ </description>
+ <priority>2</priority>
+ <example>
+<![CDATA[
+public String bar(String string) {
+ // should be &&
+ if (string!=null || !string.equals(""))
+ return string;
+ // should be ||
+ if (string==null && string.equals(""))
+ return string;
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="BigIntegerInstantiation"
+ since="3.9"
+ message="Don't create instances of already existing BigInteger and BigDecimal (ZERO, ONE, TEN)"
+ class="net.sourceforge.pmd.lang.java.rule.basic.BigIntegerInstantiationRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#BigIntegerInstantiation">
+ <description>
+Don't create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) and
+for Java 1.5 onwards, BigInteger.TEN and BigDecimal (BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN)
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+BigInteger bi = new BigInteger(1); // reference BigInteger.ONE instead
+BigInteger bi2 = new BigInteger("0"); // reference BigInteger.ZERO instead
+BigInteger bi3 = new BigInteger(0.0); // reference BigInteger.ZERO instead
+BigInteger bi4;
+bi4 = new BigInteger(0); // reference BigInteger.ZERO instead
+]]>
+ </example>
+</rule>
+
+ <rule name="AvoidUsingOctalValues"
+ since="3.9"
+ message="Do not start a literal by 0 unless it's an octal value"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingOctalValuesRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidUsingOctalValues">
+ <description>
+ <![CDATA[
+Integer literals should not start with zero since this denotes that the rest of literal will be
+interpreted as an octal value.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+int i = 012; // set i with 10 not 12
+int j = 010; // set j with 8 not 10
+k = i * j; // set k with 80 not 120
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="AvoidUsingHardCodedIP"
+ since="4.1"
+ message="Do not hard code the IP address ${variableName}"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingHardCodedIPRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidUsingHardCodedIP">
+ <description>
+ <![CDATA[
+Application with hard-coded IP addresses can become impossible to deploy in some cases.
+Externalizing IP adresses is preferable.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="pattern" type="String" description="Regular Expression" value='^"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"$'/>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ private String ip = "127.0.0.1"; // not recommended
+}
+ ]]>
+ </example>
+ </rule>
+
+ <!--
+ not available in maven-pmd-plugin ???
+ <rule name="CheckResultSet"
+ language="java"
+ since="4.1"
+ class="net.sourceforge.pmd.lang.java.rule.basic.CheckResultSetRule"
+ message="Always check the return of one of the navigation method (next,previous,first,last) of a ResultSet."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#CheckResultSet">
+ <description>
+ <![CDATA[
+Always check the return values of navigation methods (next, previous, first, last) of a ResultSet.
+If the value return is 'false', it should be handled properly.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+Statement stat = conn.createStatement();
+ResultSet rst = stat.executeQuery("SELECT name FROM person");
+rst.next(); // what if it returns false? bad form
+String firstName = rst.getString(1);
+
+Statement stat = conn.createStatement();
+ResultSet rst = stat.executeQuery("SELECT name FROM person");
+if (rst.next()) { // result is properly examined and used
+ String firstName = rst.getString(1);
+ } else {
+ // handle missing data
+}
+ ]]>
+ </example>
+ </rule>
+ -->
+
+ <rule name="AvoidMultipleUnaryOperators"
+ since="4.2"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidMultipleUnaryOperatorsRule"
+ message="Using multiple unary operators may be a bug, and/or is confusing."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidMultipleUnaryOperators">
+ <description>
+ <![CDATA[
+The use of multiple unary operators may be problematic, and/or confusing.
+Ensure that the intended usage is not a bug, or consider simplifying the expression.
+ ]]>
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+// These are typo bugs, or at best needlessly complex and confusing:
+int i = - -1;
+int j = + - +1;
+int z = ~~2;
+boolean b = !!true;
+boolean c = !!!true;
+
+// These are better:
+int i = 1;
+int j = -1;
+int z = 2;
+boolean b = true;
+boolean c = false;
+
+// And these just make your brain hurt:
+int i = ~-2;
+int j = -~7;
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ExtendsObject"
+ language="java"
+ since="5.0"
+ message="No need to explicitly extend Object."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ExtendsObject">
+ <description>No need to explicitly extend Object.</description>
+ <priority>4</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ExtendsList/ClassOrInterfaceType[@Image='Object' or @Image='java.lang.Object']
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo extends Object { // not required
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="CheckSkipResult"
+ language="java"
+ since="5.0"
+ message="Check the value returned by the skip() method of an InputStream to see if the requested number of bytes has been skipped."
+ class="net.sourceforge.pmd.lang.java.rule.basic.CheckSkipResultRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#CheckSkipResult">
+ <description>The skip() method may skip a smaller number of bytes than requested. Check the returned value to find out if it was the case or not.</description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public class Foo {
+
+ private FileInputStream _s = new FileInputStream("file");
+
+ public void skip(int n) throws IOException {
+ _s.skip(n); // You are not sure that exactly n bytes are skipped
+ }
+
+ public void skipExactly(int n) throws IOException {
+ while (n != 0) {
+ long skipped = _s.skip(n);
+ if (skipped == 0)
+ throw new EOFException();
+ n -= skipped;
+ }
+ }
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="AvoidBranchingStatementAsLastInLoop"
+ since="5.0"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidBranchingStatementAsLastInLoopRule"
+ message="Avoid using a branching statement as the last in a loop."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidBranchingStatementAsLastInLoop">
+ <description>
+ <![CDATA[
+Using a branching statement as the last part of a loop may be a bug, and/or is confusing.
+Ensure that the usage is not a bug, or consider using another approach.
+ ]]>
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+ // unusual use of branching statement in a loop
+for (int i = 0; i < 10; i++) {
+ if (i*i <= 25) {
+ continue;
+ }
+ break;
+}
+
+ // this makes more sense...
+for (int i = 0; i < 10; i++) {
+ if (i*i > 25) {
+ break;
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="DontCallThreadRun"
+ language="java"
+ since="4.3"
+ message="Don't call Thread.run() explicitly, use Thread.start()"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#DontCallThreadRun">
+ <description>
+Explicitly calling Thread.run() method will execute in the caller's thread of control. Instead, call Thread.start() for the intended behavior.
+ </description>
+ <priority>4</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//StatementExpression/PrimaryExpression
+[
+ PrimaryPrefix
+ [
+ ./Name[ends-with(@Image, '.run') or @Image = 'run']
+ and substring-before(Name/@Image, '.') =//VariableDeclarator/VariableDeclaratorId/@Image
+ [../../../Type/ReferenceType[ClassOrInterfaceType/@Image = 'Thread']]
+ or (
+ ./AllocationExpression/ClassOrInterfaceType[@Image = 'Thread']
+ and ../PrimarySuffix[@Image = 'run'])
+ ]
+]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+Thread t = new Thread();
+t.run(); // use t.start() instead
+new Thread().run(); // same violation
+]]>
+ </example>
+ </rule>
+
+ <rule name="DontUseFloatTypeForLoopIndices"
+ language="java"
+ since="4.3"
+ message="Don't use floating point for loop indices. If you must use floating point, use double."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#DontUseFloatTypeForLoopIndices">
+ <description>
+Don't use floating point for loop indices. If you must use floating point, use double
+unless you're certain that float provides enough precision and you have a compelling
+performance need (space or time).
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//ForStatement/ForInit/LocalVariableDeclaration
+/Type/PrimitiveType[@Image="float"]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+public class Count {
+ public static void main(String[] args) {
+ final int START = 2000000000;
+ int count = 0;
+ for (float f = START; f < START + 50; f++)
+ count++;
+ //Prints 0 because (float) START == (float) (START + 50).
+ System.out.println(count);
+ //The termination test misbehaves due to floating point granularity.
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyCatchBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyIfStmt" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyWhileStmt" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyTryBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyFinallyBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySwitchStatements" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySynchronizedBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementNotInLoop" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyInitializer" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStaticInitializer" />
+
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryConversionTemporary" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryReturn" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryFinalModifier" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOverridingMethod" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOperationOnImmutable" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnusedNullCheckInEquals" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessParentheses" />
+
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/64bbed4a/example/application/simpleapp/modules/pmd-rulesets/imports.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/pmd-rulesets/imports.xml b/example/application/simpleapp/modules/pmd-rulesets/imports.xml
new file mode 100644
index 0000000..8948262
--- /dev/null
+++ b/example/application/simpleapp/modules/pmd-rulesets/imports.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0"?>
+
+<ruleset name="Import Statements"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+
+ <description>
+These rules deal with different problems that can occur with import statements.
+ </description>
+
+ <rule name="DuplicateImports"
+ since="0.5"
+ message="Avoid duplicate imports such as ''{0}''"
+ class="net.sourceforge.pmd.lang.java.rule.imports.DuplicateImportsRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#DuplicateImports">
+ <description>
+Duplicate or overlapping import statements should be avoided.
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+import java.lang.String;
+import java.lang.*;
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="DontImportJavaLang"
+ since="0.5"
+ message="Avoid importing anything from the package 'java.lang'"
+ class="net.sourceforge.pmd.lang.java.rule.imports.DontImportJavaLangRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#DontImportJavaLang">
+ <description>
+Avoid importing anything from the package 'java.lang'. These classes are automatically imported (JLS 7.5.3).
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+import java.lang.String; // this is unnecessary
+
+public class Foo {}
+
+// --- in another source code file...
+
+import java.lang.*; // this is bad
+
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedImports"
+ since="1.0"
+ message="Avoid unused imports such as ''{0}''"
+ class="net.sourceforge.pmd.lang.java.rule.imports.UnusedImportsRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#UnusedImports">
+ <description>
+Avoid the use of unused import statements to prevent unwanted dependencies.
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+// this is bad
+import java.io.File;
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="ImportFromSamePackage"
+ since="1.02"
+ message="No need to import a type that lives in the same package"
+ class="net.sourceforge.pmd.lang.java.rule.imports.ImportFromSamePackageRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#ImportFromSamePackage">
+ <description>
+There is no need to import a type that lives in the same package.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+ package foo;
+
+ import foo.Buz; // no need for this
+ import foo.*; // or this
+
+ public class Bar{}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="TooManyStaticImports"
+ language="java"
+ since="4.1"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ message="Too many static imports may lead to messy code"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#TooManyStaticImports">
+ <description><![CDATA[
+If you overuse the static import feature, it can make your program unreadable and
+unmaintainable, polluting its namespace with all the static members you import.
+Readers of your code (including you, a few months after you wrote it) will not know
+which class a static member comes from (Sun 1.5 Language Guide).
+ ]]></description>
+ <priority>3</priority>
+ <properties>
+ <property name="maximumStaticImports" type="Integer"
+ description="All static imports can be disallowed by setting this to 0" min="0" max="100" value="4"/>
+ <property name="xpath">
+ <value><![CDATA[
+.[count(ImportDeclaration[@Static = 'true']) > $maximumStaticImports]
+ ]]></value>
+ </property>
+ </properties>
+ <example><![CDATA[
+import static Lennon;
+import static Ringo;
+import static George;
+import static Paul;
+import static Yoko; // Too much !
+ ]]></example>
+ </rule>
+
+ <rule name="UnnecessaryFullyQualifiedName"
+ language="java"
+ since="5.0"
+ class="net.sourceforge.pmd.lang.java.rule.imports.UnnecessaryFullyQualifiedNameRule"
+ message="Unnecessary use of fully qualified name ''{0}'' due to existing import ''{1}''"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#UnnecessaryFullyQualifiedName">
+ <description><![CDATA[
+Import statements allow the use of non-fully qualified names. The use of a fully qualified name
+which is covered by an import statement is redundant. Consider using the non-fully qualified name.
+ ]]></description>
+ <priority>4</priority>
+ <example><![CDATA[
+import java.util.List;
+
+public class Foo {
+ private java.util.List list1; // Unnecessary FQN
+ private List list2; // More appropriate given import of 'java.util.List'
+}
+ ]]></example>
+ </rule>
+
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/64bbed4a/example/application/simpleapp/modules/pmd-rulesets/rulesets.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/pmd-rulesets/rulesets.properties b/example/application/simpleapp/modules/pmd-rulesets/rulesets.properties
new file mode 100644
index 0000000..d95e632
--- /dev/null
+++ b/example/application/simpleapp/modules/pmd-rulesets/rulesets.properties
@@ -0,0 +1 @@
+rulesets.filenames=rulesets/java/basic.xml,rulesets/java/imports.xml,rulesets/java/unusedcode.xml
http://git-wip-us.apache.org/repos/asf/isis/blob/64bbed4a/example/application/simpleapp/modules/pmd-rulesets/unusedcode.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/pmd-rulesets/unusedcode.xml b/example/application/simpleapp/modules/pmd-rulesets/unusedcode.xml
new file mode 100644
index 0000000..802d18f
--- /dev/null
+++ b/example/application/simpleapp/modules/pmd-rulesets/unusedcode.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+
+<ruleset name="Unused Code"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+ <description>
+The Unused Code ruleset contains rules that find unused or ineffective code.
+ </description>
+
+ <rule name="UnusedPrivateField"
+ since="0.1"
+ language="java"
+ message="Avoid unused private fields such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateFieldRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedPrivateField">
+ <description>
+Detects when a private field is declared and/or assigned a value, but not used.
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+public class Something {
+ private static int FOO = 2; // Unused
+ private int i = 5; // Unused
+ private int j = 6;
+ public int addOne() {
+ return j++;
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedLocalVariable"
+ language="java"
+ since="0.1"
+ message="Avoid unused local variables such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedLocalVariableRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedLocalVariable">
+ <description>
+Detects when a local variable is declared and/or assigned, but not used.
+ </description>
+ <priority>3</priority>
+
+ <example>
+<![CDATA[
+public class Foo {
+ public void doSomething() {
+ int i = 5; // Unused
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedPrivateMethod"
+ language="java"
+ since="0.7"
+ message="Avoid unused private methods such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateMethodRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedPrivateMethod">
+ <description>
+Unused Private Method detects when a private method is declared but is unused.
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+public class Something {
+ private void foo() {} // unused
+}
+]]>
+ </example>
+ </rule>
+
+
+ <rule name="UnusedFormalParameter"
+ language="java"
+ since="0.8"
+ message="Avoid unused {0} parameters such as ''{1}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedFormalParameterRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedFormalParameter">
+ <description>
+Avoid passing parameters to methods or constructors without actually referencing them in the method body.
+ </description>
+ <priority>3</priority>
+
+ <example>
+<![CDATA[
+public class Foo {
+ private void bar(String howdy) {
+ // howdy is not used
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedModifier"
+ language="java"
+ since="1.02"
+ message="Avoid modifiers which are implied by the context"
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedModifierRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedModifier">
+ <description>
+Fields in interfaces are automatically public static final, and methods are public abstract.
+Classes or interfaces nested in an interface are automatically public and static (all nested interfaces are automatically static).
+For historical reasons, modifiers which are implied by the context are accepted by the compiler, but are superfluous.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public interface Foo {
+ public abstract void bar(); // both abstract and public are ignored by the compiler
+ public static final int X = 0; // public, static, and final all ignored
+ public static class Bar {} // public, static ignored
+ public static interface Baz {} // ditto
+}
+public class Bar {
+ public static interface Baz {} // static ignored
+}
+ ]]>
+ </example>
+ </rule>
+ </ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/64bbed4a/example/application/simpleapp/modules/pmd.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/pmd.xml b/example/application/simpleapp/modules/pmd.xml
new file mode 100644
index 0000000..dbaf4af
--- /dev/null
+++ b/example/application/simpleapp/modules/pmd.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<ruleset name="Maven Ruleset"
+ xmlns="http://pmd.sf.net/ruleset/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
+ xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+
+ <!--
+ Customized PMD ruleset for Maven, see [0] for more information
+ [0] http://pmd.sourceforge.net/howtomakearuleset.html
+ -->
+
+ <description>
+ This ruleset checks the code for discouraged programming constructs.
+ </description>
+
+ <rule ref="pmd-rulesets/basic.xml">
+ <exclude name="EmptyCatchBlock"/>
+ </rule>
+ <rule ref="pmd-rulesets/basic.xml/EmptyCatchBlock">
+ <properties>
+ <property name="allowCommentedBlocks" value="true"/>
+ </properties>
+ </rule>
+
+ <rule ref="pmd-rulesets/unusedcode.xml"/>
+ <rule ref="pmd-rulesets/imports.xml"/>
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/64bbed4a/example/application/simpleapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/pom.xml b/example/application/simpleapp/pom.xml
index 7c39f9d..8d0d11e 100644
--- a/example/application/simpleapp/pom.xml
+++ b/example/application/simpleapp/pom.xml
@@ -67,100 +67,6 @@
</repository>
</repositories>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <version>1.3.1</version>
- <configuration>
- <rules>
- <requireMavenVersion>
- <version>[3.2.1,)</version>
- </requireMavenVersion>
- <requireJavaVersion>
- <version>[1.8.0,)</version>
- </requireJavaVersion>
- <requirePluginVersions>
- <message>All plugin versions must be defined!</message>
- <banLatest>true</banLatest>
- <banRelease>true</banRelease>
- </requirePluginVersions>
- <DependencyConvergence />
- </rules>
- </configuration>
- <executions>
- <execution>
- <id>validate-enforce</id>
- <phase>validate</phase>
- <goals>
- <goal>enforce</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- <compilerArgument>-parameters</compilerArgument>
- </configuration>
- <executions>
- <execution>
- <id>source</id>
- <phase>compile</phase>
- </execution>
- <execution>
- <id>test</id>
- <phase>test-compile</phase>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.5</version>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
- </plugin>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <version>2.5.1</version>
- </plugin>
- <plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.8.1</version>
- </plugin>
- <plugin>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.3</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
<modules>
<module>modules/module-simple</module>
<module>application</module>
http://git-wip-us.apache.org/repos/asf/isis/blob/64bbed4a/example/application/simpleapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/pom.xml b/example/application/simpleapp/webapp/pom.xml
index 892da9f..3e019a9 100644
--- a/example/application/simpleapp/webapp/pom.xml
+++ b/example/application/simpleapp/webapp/pom.xml
@@ -37,6 +37,9 @@
<danhaywood-mavenmixin-isisswagger.appManifest>domainapp.application.manifest.DomainAppAppManifest</danhaywood-mavenmixin-isisswagger.appManifest>
<danhaywood-mavenmixin-isisswagger.dependency.artifactId>${project.parent.artifactId}-application</danhaywood-mavenmixin-isisswagger.dependency.artifactId>
<danhaywood-mavenmixin-jettywar.warName>${project.parent.artifactId}</danhaywood-mavenmixin-jettywar.warName>
+
+ <danhaywood-mavenmixin-jettyconsole.backgroundImage>${basedir}/src/main/jettyconsole/isis-banner.png</danhaywood-mavenmixin-jettyconsole.backgroundImage>
+
</properties>
<build>
@@ -79,6 +82,16 @@
<mixins>
<mixin>
<groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>standard</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>enforcerrelaxed</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
<artifactId>isisswagger</artifactId>
<version>0.0.2</version>
</mixin>
@@ -87,6 +100,11 @@
<artifactId>jettywar</artifactId>
<version>0.0.1</version>
</mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>jettyconsole</artifactId>
+ <version>0.0.1</version>
+ </mixin>
</mixins>
</configuration>
</plugin>
[03/11] isis git commit: ISIS-1542: adds HSQL DB Manager to simpleapp
application
Posted by da...@apache.org.
ISIS-1542: adds HSQL DB Manager to simpleapp application
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/792be3ed
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/792be3ed
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/792be3ed
Branch: refs/heads/maint-1.13.2
Commit: 792be3edbed0832b14eacd5c5bad504037a61f77
Parents: cbdf6c2
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Nov 24 10:46:57 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 24 10:46:57 2016 +0000
----------------------------------------------------------------------
.../services/dbmanager/HsqlDbManagerMenu.java | 73 ++++++++++++++++++++
.../services/homepage/HomePageService.java | 17 ++---
2 files changed, 77 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/792be3ed/example/application/simpleapp/application/src/main/java/domainapp/application/services/dbmanager/HsqlDbManagerMenu.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/application/src/main/java/domainapp/application/services/dbmanager/HsqlDbManagerMenu.java b/example/application/simpleapp/application/src/main/java/domainapp/application/services/dbmanager/HsqlDbManagerMenu.java
new file mode 100644
index 0000000..ab8397a
--- /dev/null
+++ b/example/application/simpleapp/application/src/main/java/domainapp/application/services/dbmanager/HsqlDbManagerMenu.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package domainapp.application.services.dbmanager;
+
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+
+import com.google.common.base.Strings;
+
+import org.hsqldb.util.DatabaseManagerSwing;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.ActionLayout;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.annotation.RestrictTo;
+import org.apache.isis.applib.annotation.SemanticsOf;
+
+@DomainService(
+ nature = NatureOfService.VIEW_MENU_ONLY
+)
+@DomainServiceLayout(
+ named = "Prototyping",
+ menuOrder = "999",
+ menuBar = DomainServiceLayout.MenuBar.SECONDARY
+)
+public class HsqlDbManagerMenu {
+
+
+ private String url;
+
+ @PostConstruct
+ public void init(Map<String,String> properties) {
+ this.url = properties.get("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL");
+ }
+
+
+ @Action(
+ semantics = SemanticsOf.SAFE,
+ restrictTo = RestrictTo.PROTOTYPING
+ )
+ @ActionLayout(
+ named = "HSQL DB Manager",
+ cssClassFa = "database"
+ )
+ public void hsqlDbManager() {
+ String[] args = {"--url", url, "--noexit" };
+ DatabaseManagerSwing.main(args);
+ }
+ public boolean hideHsqlDbManager() {
+ return Strings.isNullOrEmpty(url) || !url.contains("hsqldb:mem");
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/792be3ed/example/application/simpleapp/application/src/main/java/domainapp/application/services/homepage/HomePageService.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/application/src/main/java/domainapp/application/services/homepage/HomePageService.java b/example/application/simpleapp/application/src/main/java/domainapp/application/services/homepage/HomePageService.java
index 112b7ba..71a5b30 100644
--- a/example/application/simpleapp/application/src/main/java/domainapp/application/services/homepage/HomePageService.java
+++ b/example/application/simpleapp/application/src/main/java/domainapp/application/services/homepage/HomePageService.java
@@ -23,29 +23,20 @@ import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.HomePage;
import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.services.registry.ServiceRegistry;
+import org.apache.isis.applib.services.factory.FactoryService;
@DomainService(
nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY // trick to suppress the actions from the top-level menu
)
public class HomePageService {
- //region > homePage (action)
-
- @Action(
- semantics = SemanticsOf.SAFE
- )
+ @Action(semantics = SemanticsOf.SAFE)
@HomePage
public HomePageViewModel homePage() {
- return serviceRegistry.injectServicesInto(new HomePageViewModel());
+ return factoryService.instantiate(HomePageViewModel.class);
}
- //endregion
-
- //region > injected services
@javax.inject.Inject
- ServiceRegistry serviceRegistry;
-
- //endregion
+ FactoryService factoryService;
}
[02/11] isis git commit: ISIS-1538: updates simpleapp to use
mavendep's
Posted by da...@apache.org.
ISIS-1538: updates simpleapp to use mavendep's
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/cbdf6c2d
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/cbdf6c2d
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/cbdf6c2d
Branch: refs/heads/maint-1.13.2
Commit: cbdf6c2d639edac79de6beb74633e607c93b77c1
Parents: 64bbed4
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Nov 24 10:29:38 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 24 10:29:38 2016 +0000
----------------------------------------------------------------------
.../application/simpleapp/application/pom.xml | 22 +++---------
.../simpleapp/modules/module-simple/pom.xml | 32 +++---------------
example/application/simpleapp/webapp/pom.xml | 35 +++++---------------
3 files changed, 16 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/cbdf6c2d/example/application/simpleapp/application/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/application/pom.xml b/example/application/simpleapp/application/pom.xml
index aab34cd..2eb8607 100644
--- a/example/application/simpleapp/application/pom.xml
+++ b/example/application/simpleapp/application/pom.xml
@@ -112,24 +112,10 @@
</dependency>
<dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-security-shiro</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-integtestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-specsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
+ <groupId>com.danhaywood.mavendeps</groupId>
+ <artifactId>isistesting</artifactId>
+ <version>0.0.2</version>
+ <type>pom</type>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/isis/blob/cbdf6c2d/example/application/simpleapp/modules/module-simple/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/module-simple/pom.xml b/example/application/simpleapp/modules/module-simple/pom.xml
index ff125fc..f21dba4 100644
--- a/example/application/simpleapp/modules/module-simple/pom.xml
+++ b/example/application/simpleapp/modules/module-simple/pom.xml
@@ -131,34 +131,10 @@
</dependency>
<dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-integtestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-specsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.objenesis</groupId>
- <artifactId>objenesis</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
+ <groupId>com.danhaywood.mavendeps</groupId>
+ <artifactId>isistesting</artifactId>
+ <version>0.0.2</version>
+ <type>pom</type>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/isis/blob/cbdf6c2d/example/application/simpleapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/pom.xml b/example/application/simpleapp/webapp/pom.xml
index 3e019a9..d01d182 100644
--- a/example/application/simpleapp/webapp/pom.xml
+++ b/example/application/simpleapp/webapp/pom.xml
@@ -118,21 +118,17 @@
</dependency>
<dependency>
- <groupId>org.apache.isis.viewer</groupId>
- <artifactId>isis-viewer-wicket-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-viewer-restfulobjects-server</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-security-shiro</artifactId>
+ <groupId>com.danhaywood.mavendeps</groupId>
+ <artifactId>isiswebapp</artifactId>
+ <version>0.0.1</version>
+ <type>pom</type>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <groupId>com.danhaywood.mavendeps</groupId>
+ <artifactId>isisintellij</artifactId>
+ <version>0.0.1</version>
+ <type>pom</type>
</dependency>
</dependencies>
@@ -213,21 +209,6 @@
</dependencies>
</profile>
-->
-
- <profile>
- <id>intellij</id>
- <activation>
- <property>
- <name>idea.version</name>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-webserver</artifactId>
- </dependency>
- </dependencies>
- </profile>
</profiles>
</project>
[07/11] isis git commit: ISIS-1538: moves static analysis check files
to subdirectory
Posted by da...@apache.org.
ISIS-1538: moves static analysis check files to subdirectory
(trying to resolve issue with subsequent creation/generation of archetype)
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/f921dc5d
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/f921dc5d
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/f921dc5d
Branch: refs/heads/maint-1.13.2
Commit: f921dc5d83f0f509bd6664b0d1cc8d5756cfd1d4
Parents: c221ea9
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Nov 24 11:37:22 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 24 11:37:22 2016 +0000
----------------------------------------------------------------------
.../simpleapp/modules/checks/checkstyle.xml | 287 +++++++
.../modules/checks/pmd-rulesets/basic.xml | 807 +++++++++++++++++++
.../modules/checks/pmd-rulesets/imports.xml | 145 ++++
.../checks/pmd-rulesets/rulesets.properties | 1 +
.../modules/checks/pmd-rulesets/unusedcode.xml | 125 +++
.../simpleapp/modules/checks/pmd.xml | 46 ++
.../simpleapp/modules/checkstyle.xml | 287 -------
.../simpleapp/modules/module-simple/pom.xml | 4 +-
.../simpleapp/modules/pmd-rulesets/basic.xml | 807 -------------------
.../simpleapp/modules/pmd-rulesets/imports.xml | 145 ----
.../modules/pmd-rulesets/rulesets.properties | 1 -
.../modules/pmd-rulesets/unusedcode.xml | 125 ---
example/application/simpleapp/modules/pmd.xml | 46 --
13 files changed, 1413 insertions(+), 1413 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/checks/checkstyle.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/checks/checkstyle.xml b/example/application/simpleapp/modules/checks/checkstyle.xml
new file mode 100644
index 0000000..033c545
--- /dev/null
+++ b/example/application/simpleapp/modules/checks/checkstyle.xml
@@ -0,0 +1,287 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
+
+<!--
+
+ Checkstyle configuration that checks the sun coding conventions from:
+
+ - the Java Language Specification at
+ http://java.sun.com/docs/books/jls/second_edition/html/index.html
+
+ - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+
+ - the Javadoc guidelines at
+ http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+
+ - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+
+ - some best practices
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.sf.net (or in your downloaded distribution).
+
+ Most Checks are configurable, be sure to consult the documentation.
+
+ To completely disable a check, just comment it out or delete it from the file.
+
+ Finally, it is worth reading the documentation.
+
+-->
+
+<module name="Checker">
+
+ <!-- Checks that a package.html file exists for each package. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
+ <module name="JavadocPackage"/>
+ <!--
+ -->
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+ <!--
+ <module name="NewlineAtEndOfFile"/>
+ -->
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+ <module name="Translation"/>
+
+ <!--
+ eg:
+ //CHECKSTYLE.OFF: IllegalCatch - Much more readable than catching 7 exceptions
+ catch (Exception e)
+ //CHECKSTYLE.ON: IllegalCatch
+ -->
+ <module name="SuppressionCommentFilter">
+ <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
+ <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
+ <property name="checkFormat" value="$1"/>
+ </module>
+
+ <!--
+ eg:
+ // CHECKSTYLE IGNORE check FOR NEXT 1 LINES
+ public void onClick(View view) { ... } -->
+ <module name="SuppressWithNearbyCommentFilter">
+ <property name="commentFormat" value="CHECKSTYLE.IGNORE (\w+) FOR NEXT (\d+) LINES"/>
+ <property name="checkFormat" value="$1"/>
+ <property name="influenceFormat" value="$2"/>
+ </module>
+
+ <module name="TreeWalker">
+
+ <property name="cacheFile" value="${checkstyle.cache.file}"/>
+
+ <!-- not available in eclipse-cs
+ <module name="JavadocDeprecated"/>
+ -->
+ <module name="MissingOverride"/>
+
+ <!-- ************************************************************** -->
+ <!-- Checks that are different from the sun coding conventions ones -->
+ <!-- ************************************************************** -->
+ <property name="tabWidth" value="4"/>
+ <module name="LeftCurly">
+ <property name="option" value="eol"/>
+ </module>
+ <module name="RightCurly">
+ <property name="option" value="same"/>
+ </module>
+ <module name="MemberName">
+ <property name="format" value="^[a-z]([a-zA-Z0-9])*$"/>
+ </module>
+ <module name="StaticVariableName">
+ <property name="format" value="^[A-Z](_?[A-Z0-9])*$"/>
+ </module>
+ <module name="MethodName">
+ <property name="format" value="[a-z](_?[a-zA-Z0-9]+)*$"/>
+ </module>
+ <module name="ParameterName">
+ <property name="format" value="[a-z]([a-zA-Z0-9]+)*$"/>
+ </module>
+ <module name="LocalVariableName">
+ <property name="format" value="[a-z]([a-zA-Z0-9]+)*$"/>
+ </module>
+
+ <!-- ************************************************************** -->
+ <!-- Default Sun coding conventions checks -->
+ <!-- ************************************************************** -->
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+
+ <!-- TODO: instate at some point (though only for public methods
+ <module name="JavadocType"/>
+ -->
+ <!--
+ <module name="JavadocMethod"/>
+ <module name="JavadocVariable"/>
+ -->
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName"/>
+ <module name="PackageName"/>
+ <module name="TypeName"/>
+ <module name="LocalFinalVariableName"/>
+
+
+ <!-- Checks for Headers -->
+ <!-- See http://checkstyle.sf.net/config_header.html -->
+ <!--
+ <module name="Header">
+ -->
+ <!-- The follow property value demonstrates the ability -->
+ <!-- to have access to ANT properties. In this case it uses -->
+ <!-- the ${basedir} property to allow Checkstyle to be run -->
+ <!-- from any directory within a project. -->
+ <!--
+ <property name="headerFile" value="${checkstyle.header.file}"/>
+ </module>
+ -->
+
+ <!-- Following interprets the header file as regular expressions. -->
+ <!-- <module name="RegexpHeader"/> -->
+
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport"/>
+ <module name="IllegalImport"/>
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="EmptyBlock"/>
+ <module name="NeedBraces"/>
+ <!--
+ <module name="AvoidNestedBlocks"/>
+ -->
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <module name="EmptyStatement"/>
+ <module name="MagicNumber"/>
+ <module name="MissingSwitchDefault"/>
+ <module name="RedundantThrows"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+
+ <!-- not supported in maven
+ <module name="DoubleCheckedLocking"/>
+ -->
+ <!--
+ <module name="AvoidInlineConditionals"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField"/>
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+ -->
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!--
+
+ <module name="VisibilityModifier"/>
+ -->
+ <!-- too many violations...
+ <module name="DesignForExtension"/>
+ -->
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ <module name="InterfaceIsType"/>
+
+
+ <module name="CyclomaticComplexity">
+ <property name="max" value="12"/>
+ </module>
+ <module name="NPathComplexity">
+ <property name="max" value="160"/>
+ </module>
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <!--
+ <module name="ArrayTypeStyle"/>
+ <module name="GenericIllegalRegexp">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+ -->
+ <!-- removed; we detect these in other ways.
+ <module name="TodoComment"/>
+ -->
+ <module name="UpperEll"/>
+ <module name="FinalParameters"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <!--
+ <module name="NoWhitespaceAfter"/>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+ <module name="TabCharacter"/>
+ -->
+ <module name="EmptyForIteratorPad"/>
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <!--
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+ -->
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="LineLength">
+ <property name="max" value="120"/>
+ </module>
+ <module name="MethodLength">
+ <property name="max" value="30"/>
+ </module>
+ <module name="ParameterNumber">
+ <property name="max" value="6"/>
+ </module>
+
+ </module>
+
+
+
+ <module name="FileLength">
+ <property name="max" value="1500"/>
+ </module>
+
+ <module name="FileTabCharacter">
+ <property name="eachLine" value="true"/>
+ <property name="fileExtensions" value="java,xml"/>
+ </module>
+
+</module>
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/checks/pmd-rulesets/basic.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/checks/pmd-rulesets/basic.xml b/example/application/simpleapp/modules/checks/pmd-rulesets/basic.xml
new file mode 100644
index 0000000..f18af2c
--- /dev/null
+++ b/example/application/simpleapp/modules/checks/pmd-rulesets/basic.xml
@@ -0,0 +1,807 @@
+<?xml version="1.0"?>
+
+<ruleset name="Basic"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+ <description>
+The Basic ruleset contains a collection of good practices which should be followed.
+ </description>
+
+ <rule name="JumbledIncrementer"
+ language="java"
+ since="1.0"
+ message="Avoid modifying an outer loop incrementer in an inner loop for update expression"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#JumbledIncrementer">
+ <description>
+Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ForStatement
+ [
+ ForUpdate/StatementExpressionList/StatementExpression/PostfixExpression/PrimaryExpression/PrimaryPrefix/Name/@Image
+ =
+ ancestor::ForStatement/ForInit//VariableDeclaratorId/@Image
+ ]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class JumbledIncrementerRule1 {
+ public void foo() {
+ for (int i = 0; i < 10; i++) { // only references 'i'
+ for (int k = 0; k < 20; i++) { // references both 'i' and 'k'
+ System.out.println("Hello");
+ }
+ }
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ForLoopShouldBeWhileLoop"
+ language="java"
+ since="1.02"
+ message="This for loop could be simplified to a while loop"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ForLoopShouldBeWhileLoop">
+ <description>
+Some for loops can be simplified to while loops, this makes them more concise.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ForStatement
+ [count(*) > 1]
+ [not(LocalVariableDeclaration)]
+ [not(ForInit)]
+ [not(ForUpdate)]
+ [not(Type and Expression and Statement)]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ void bar() {
+ for (;true;) true; // No Init or Update part, may as well be: while (true)
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="OverrideBothEqualsAndHashcode"
+ language="java"
+ since="0.4"
+ message="Ensure you override both equals() and hashCode()"
+ class="net.sourceforge.pmd.lang.java.rule.basic.OverrideBothEqualsAndHashcodeRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#OverrideBothEqualsAndHashcode">
+ <description>
+Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public class Bar { // poor, missing a hashcode() method
+ public boolean equals(Object o) {
+ // do some comparison
+ }
+}
+
+public class Baz { // poor, missing an equals() method
+ public int hashCode() {
+ // return some hash value
+ }
+}
+
+public class Foo { // perfect, both methods provided
+ public boolean equals(Object other) {
+ // do some comparison
+ }
+ public int hashCode() {
+ // return some hash value
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="DoubleCheckedLocking"
+ language="java"
+ since="1.04"
+ message="Double checked locking is not thread safe in Java."
+ class="net.sourceforge.pmd.lang.java.rule.basic.DoubleCheckedLockingRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#DoubleCheckedLocking">
+ <description>
+Partially created objects can be returned by the Double Checked Locking pattern when used in Java.
+An optimizing JRE may assign a reference to the baz variable before it creates the object the
+reference is intended to point to.
+
+For more details refer to: http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html
+ </description>
+ <priority>1</priority>
+ <example>
+ <![CDATA[
+public class Foo {
+ Object baz;
+ Object bar() {
+ if (baz == null) { // baz may be non-null yet not fully created
+ synchronized(this) {
+ if (baz == null) {
+ baz = new Object();
+ }
+ }
+ }
+ return baz;
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ReturnFromFinallyBlock"
+ language="java"
+ since="1.05"
+ message="Avoid returning from a finally block"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ReturnFromFinallyBlock">
+ <description>
+Avoid returning from a finally block, this can discard exceptions.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//FinallyStatement//ReturnStatement
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Bar {
+ public String foo() {
+ try {
+ throw new Exception( "My Exception" );
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ return "A. O. K."; // return not recommended here
+ }
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnconditionalIfStatement"
+ language="java"
+ since="1.5"
+ message="Do not use 'if' statements that are always true or always false"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#UnconditionalIfStatement">
+ <description>
+Do not use "if" statements whose conditionals are always true or always false.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//IfStatement/Expression
+ [count(PrimaryExpression)=1]
+ /PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ public void close() {
+ if (true) { // fixed conditional, not recommended
+ // ...
+ }
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="BooleanInstantiation"
+ since="1.2"
+ message="Avoid instantiating Boolean objects; reference Boolean.TRUE or Boolean.FALSE or call Boolean.valueOf() instead."
+ class="net.sourceforge.pmd.lang.java.rule.basic.BooleanInstantiationRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#BooleanInstantiation">
+ <description>
+Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boolean.valueOf() instead.
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+Boolean bar = new Boolean("true"); // unnecessary creation, just reference Boolean.TRUE;
+Boolean buz = Boolean.valueOf(false); // ...., just reference Boolean.FALSE;
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="CollapsibleIfStatements"
+ language="java"
+ since="3.1"
+ message="These nested if statements could be combined"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#CollapsibleIfStatements">
+ <description>
+Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//IfStatement[@Else='false']/Statement
+ /IfStatement[@Else='false']
+ |
+//IfStatement[@Else='false']/Statement
+ /Block[count(BlockStatement)=1]/BlockStatement
+ /Statement/IfStatement[@Else='false']]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+void bar() {
+ if (x) { // original implementation
+ if (y) {
+ // do stuff
+ }
+ }
+}
+
+void bar() {
+ if (x && y) { // optimized implementation
+ // do stuff
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ClassCastExceptionWithToArray"
+ language="java"
+ since="3.4"
+ message="This usage of the Collection.toArray() method will throw a ClassCastException."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ClassCastExceptionWithToArray">
+ <description>
+When deriving an array of a specific class from your Collection, one should provide an array of
+the same class as the parameter of the toArray() method. Doing otherwise you will will result
+in a ClassCastException.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//CastExpression[Type/ReferenceType/ClassOrInterfaceType[@Image !=
+"Object"]]/PrimaryExpression
+[
+ PrimaryPrefix/Name[ends-with(@Image, '.toArray')]
+ and
+ PrimarySuffix/Arguments[count(*) = 0]
+and
+count(PrimarySuffix) = 1
+]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+Collection c = new ArrayList();
+Integer obj = new Integer(1);
+c.add(obj);
+
+ // this would trigger the rule (and throw a ClassCastException if executed)
+Integer[] a = (Integer [])c.toArray();
+
+ // this is fine and will not trigger the rule
+Integer[] b = (Integer [])c.toArray(new Integer[c.size()]);
+]]>
+ </example>
+</rule>
+
+
+<rule name="AvoidDecimalLiteralsInBigDecimalConstructor"
+ language="java"
+ since="3.4"
+ message="Avoid creating BigDecimal with a decimal (float/double) literal. Use a String literal"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidDecimalLiteralsInBigDecimalConstructor">
+ <description>
+One might assume that the result of "new BigDecimal(0.1)" is exactly equal to 0.1, but it is actually
+equal to .1000000000000000055511151231257827021181583404541015625.
+This is because 0.1 cannot be represented exactly as a double (or as a binary fraction of any finite
+length). Thus, the long value that is being passed in to the constructor is not exactly equal to 0.1,
+appearances notwithstanding.
+
+The (String) constructor, on the other hand, is perfectly predictable: 'new BigDecimal("0.1")' is
+exactly equal to 0.1, as one would expect. Therefore, it is generally recommended that the
+(String) constructor be used in preference to this one.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//AllocationExpression[ClassOrInterfaceType[@Image="BigDecimal"]
+and
+./Arguments/ArgumentList
+/Expression/PrimaryExpression/PrimaryPrefix/Literal[(not
+(ends-with
+(@Image,'"'))) and contains(@Image,".")]]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+BigDecimal bd = new BigDecimal(1.123); // loss of precision, this would trigger the rule
+
+BigDecimal bd = new BigDecimal("1.123"); // preferred approach
+
+BigDecimal bd = new BigDecimal(12); // preferred approach, ok for integer values
+]]>
+ </example>
+</rule>
+
+
+ <rule name="MisplacedNullCheck"
+ language="java"
+ since="3.5"
+ message="The null check here is misplaced; if the variable is null there'll be a NullPointerException"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#MisplacedNullCheck">
+ <description>
+The null check here is misplaced. If the variable is null a NullPointerException will be thrown.
+Either the check is useless (the variable will never be "null") or it is incorrect.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//Expression
+ /*[self::ConditionalOrExpression or self::ConditionalAndExpression]
+ /descendant::PrimaryExpression/PrimaryPrefix
+ /Name[starts-with(@Image,
+ concat(ancestor::PrimaryExpression/following-sibling::EqualityExpression
+ [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
+ /PrimaryExpression/PrimaryPrefix
+ /Name[count(../../PrimarySuffix)=0]/@Image,".")
+ )
+ ]
+ [count(ancestor::ConditionalAndExpression/EqualityExpression
+ [@Image='!=']
+ [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
+ [starts-with(following-sibling::*/PrimaryExpression/PrimaryPrefix/Name/@Image,
+ concat(./PrimaryExpression/PrimaryPrefix/Name/@Image, '.'))]
+ ) = 0
+ ]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ void bar() {
+ if (a.equals(baz) && a != null) {}
+ }
+}
+ ]]>
+ </example>
+ <example><![CDATA[
+public class Foo {
+ void bar() {
+ if (a.equals(baz) || a == null) {}
+ }
+}
+ ]]></example>
+ </rule>
+
+
+ <rule name="AvoidThreadGroup"
+ language="java"
+ since="3.6"
+ message="Avoid using java.lang.ThreadGroup; it is not thread safe"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidThreadGroup"
+ typeResolution="true">
+ <description>
+Avoid using java.lang.ThreadGroup; although it is intended to be used in a threaded environment
+it contains methods that are not thread-safe.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//AllocationExpression/ClassOrInterfaceType[pmd-java:typeof(@Image, 'java.lang.ThreadGroup')]|
+//PrimarySuffix[contains(@Image, 'getThreadGroup')]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Bar {
+ void buz() {
+ ThreadGroup tg = new ThreadGroup("My threadgroup") ;
+ tg = new ThreadGroup(tg, "my thread group");
+ tg = Thread.currentThread().getThreadGroup();
+ tg = System.getSecurityManager().getThreadGroup();
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="BrokenNullCheck"
+ since="3.8"
+ message="Method call on object which may be null"
+ class="net.sourceforge.pmd.lang.java.rule.basic.BrokenNullCheckRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#BrokenNullCheck">
+ <description>
+The null check is broken since it will throw a NullPointerException itself.
+It is likely that you used || instead of && or vice versa.
+ </description>
+ <priority>2</priority>
+ <example>
+<![CDATA[
+public String bar(String string) {
+ // should be &&
+ if (string!=null || !string.equals(""))
+ return string;
+ // should be ||
+ if (string==null && string.equals(""))
+ return string;
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="BigIntegerInstantiation"
+ since="3.9"
+ message="Don't create instances of already existing BigInteger and BigDecimal (ZERO, ONE, TEN)"
+ class="net.sourceforge.pmd.lang.java.rule.basic.BigIntegerInstantiationRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#BigIntegerInstantiation">
+ <description>
+Don't create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) and
+for Java 1.5 onwards, BigInteger.TEN and BigDecimal (BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN)
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+BigInteger bi = new BigInteger(1); // reference BigInteger.ONE instead
+BigInteger bi2 = new BigInteger("0"); // reference BigInteger.ZERO instead
+BigInteger bi3 = new BigInteger(0.0); // reference BigInteger.ZERO instead
+BigInteger bi4;
+bi4 = new BigInteger(0); // reference BigInteger.ZERO instead
+]]>
+ </example>
+</rule>
+
+ <rule name="AvoidUsingOctalValues"
+ since="3.9"
+ message="Do not start a literal by 0 unless it's an octal value"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingOctalValuesRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidUsingOctalValues">
+ <description>
+ <![CDATA[
+Integer literals should not start with zero since this denotes that the rest of literal will be
+interpreted as an octal value.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+int i = 012; // set i with 10 not 12
+int j = 010; // set j with 8 not 10
+k = i * j; // set k with 80 not 120
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="AvoidUsingHardCodedIP"
+ since="4.1"
+ message="Do not hard code the IP address ${variableName}"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingHardCodedIPRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidUsingHardCodedIP">
+ <description>
+ <![CDATA[
+Application with hard-coded IP addresses can become impossible to deploy in some cases.
+Externalizing IP adresses is preferable.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="pattern" type="String" description="Regular Expression" value='^"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"$'/>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ private String ip = "127.0.0.1"; // not recommended
+}
+ ]]>
+ </example>
+ </rule>
+
+ <!--
+ not available in maven-pmd-plugin ???
+ <rule name="CheckResultSet"
+ language="java"
+ since="4.1"
+ class="net.sourceforge.pmd.lang.java.rule.basic.CheckResultSetRule"
+ message="Always check the return of one of the navigation method (next,previous,first,last) of a ResultSet."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#CheckResultSet">
+ <description>
+ <![CDATA[
+Always check the return values of navigation methods (next, previous, first, last) of a ResultSet.
+If the value return is 'false', it should be handled properly.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+Statement stat = conn.createStatement();
+ResultSet rst = stat.executeQuery("SELECT name FROM person");
+rst.next(); // what if it returns false? bad form
+String firstName = rst.getString(1);
+
+Statement stat = conn.createStatement();
+ResultSet rst = stat.executeQuery("SELECT name FROM person");
+if (rst.next()) { // result is properly examined and used
+ String firstName = rst.getString(1);
+ } else {
+ // handle missing data
+}
+ ]]>
+ </example>
+ </rule>
+ -->
+
+ <rule name="AvoidMultipleUnaryOperators"
+ since="4.2"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidMultipleUnaryOperatorsRule"
+ message="Using multiple unary operators may be a bug, and/or is confusing."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidMultipleUnaryOperators">
+ <description>
+ <![CDATA[
+The use of multiple unary operators may be problematic, and/or confusing.
+Ensure that the intended usage is not a bug, or consider simplifying the expression.
+ ]]>
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+// These are typo bugs, or at best needlessly complex and confusing:
+int i = - -1;
+int j = + - +1;
+int z = ~~2;
+boolean b = !!true;
+boolean c = !!!true;
+
+// These are better:
+int i = 1;
+int j = -1;
+int z = 2;
+boolean b = true;
+boolean c = false;
+
+// And these just make your brain hurt:
+int i = ~-2;
+int j = -~7;
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ExtendsObject"
+ language="java"
+ since="5.0"
+ message="No need to explicitly extend Object."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ExtendsObject">
+ <description>No need to explicitly extend Object.</description>
+ <priority>4</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ExtendsList/ClassOrInterfaceType[@Image='Object' or @Image='java.lang.Object']
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo extends Object { // not required
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="CheckSkipResult"
+ language="java"
+ since="5.0"
+ message="Check the value returned by the skip() method of an InputStream to see if the requested number of bytes has been skipped."
+ class="net.sourceforge.pmd.lang.java.rule.basic.CheckSkipResultRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#CheckSkipResult">
+ <description>The skip() method may skip a smaller number of bytes than requested. Check the returned value to find out if it was the case or not.</description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public class Foo {
+
+ private FileInputStream _s = new FileInputStream("file");
+
+ public void skip(int n) throws IOException {
+ _s.skip(n); // You are not sure that exactly n bytes are skipped
+ }
+
+ public void skipExactly(int n) throws IOException {
+ while (n != 0) {
+ long skipped = _s.skip(n);
+ if (skipped == 0)
+ throw new EOFException();
+ n -= skipped;
+ }
+ }
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="AvoidBranchingStatementAsLastInLoop"
+ since="5.0"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidBranchingStatementAsLastInLoopRule"
+ message="Avoid using a branching statement as the last in a loop."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidBranchingStatementAsLastInLoop">
+ <description>
+ <![CDATA[
+Using a branching statement as the last part of a loop may be a bug, and/or is confusing.
+Ensure that the usage is not a bug, or consider using another approach.
+ ]]>
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+ // unusual use of branching statement in a loop
+for (int i = 0; i < 10; i++) {
+ if (i*i <= 25) {
+ continue;
+ }
+ break;
+}
+
+ // this makes more sense...
+for (int i = 0; i < 10; i++) {
+ if (i*i > 25) {
+ break;
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="DontCallThreadRun"
+ language="java"
+ since="4.3"
+ message="Don't call Thread.run() explicitly, use Thread.start()"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#DontCallThreadRun">
+ <description>
+Explicitly calling Thread.run() method will execute in the caller's thread of control. Instead, call Thread.start() for the intended behavior.
+ </description>
+ <priority>4</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//StatementExpression/PrimaryExpression
+[
+ PrimaryPrefix
+ [
+ ./Name[ends-with(@Image, '.run') or @Image = 'run']
+ and substring-before(Name/@Image, '.') =//VariableDeclarator/VariableDeclaratorId/@Image
+ [../../../Type/ReferenceType[ClassOrInterfaceType/@Image = 'Thread']]
+ or (
+ ./AllocationExpression/ClassOrInterfaceType[@Image = 'Thread']
+ and ../PrimarySuffix[@Image = 'run'])
+ ]
+]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+Thread t = new Thread();
+t.run(); // use t.start() instead
+new Thread().run(); // same violation
+]]>
+ </example>
+ </rule>
+
+ <rule name="DontUseFloatTypeForLoopIndices"
+ language="java"
+ since="4.3"
+ message="Don't use floating point for loop indices. If you must use floating point, use double."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#DontUseFloatTypeForLoopIndices">
+ <description>
+Don't use floating point for loop indices. If you must use floating point, use double
+unless you're certain that float provides enough precision and you have a compelling
+performance need (space or time).
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//ForStatement/ForInit/LocalVariableDeclaration
+/Type/PrimitiveType[@Image="float"]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+public class Count {
+ public static void main(String[] args) {
+ final int START = 2000000000;
+ int count = 0;
+ for (float f = START; f < START + 50; f++)
+ count++;
+ //Prints 0 because (float) START == (float) (START + 50).
+ System.out.println(count);
+ //The termination test misbehaves due to floating point granularity.
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyCatchBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyIfStmt" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyWhileStmt" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyTryBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyFinallyBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySwitchStatements" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySynchronizedBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementNotInLoop" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyInitializer" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStaticInitializer" />
+
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryConversionTemporary" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryReturn" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryFinalModifier" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOverridingMethod" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOperationOnImmutable" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnusedNullCheckInEquals" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessParentheses" />
+
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/checks/pmd-rulesets/imports.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/checks/pmd-rulesets/imports.xml b/example/application/simpleapp/modules/checks/pmd-rulesets/imports.xml
new file mode 100644
index 0000000..8948262
--- /dev/null
+++ b/example/application/simpleapp/modules/checks/pmd-rulesets/imports.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0"?>
+
+<ruleset name="Import Statements"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+
+ <description>
+These rules deal with different problems that can occur with import statements.
+ </description>
+
+ <rule name="DuplicateImports"
+ since="0.5"
+ message="Avoid duplicate imports such as ''{0}''"
+ class="net.sourceforge.pmd.lang.java.rule.imports.DuplicateImportsRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#DuplicateImports">
+ <description>
+Duplicate or overlapping import statements should be avoided.
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+import java.lang.String;
+import java.lang.*;
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="DontImportJavaLang"
+ since="0.5"
+ message="Avoid importing anything from the package 'java.lang'"
+ class="net.sourceforge.pmd.lang.java.rule.imports.DontImportJavaLangRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#DontImportJavaLang">
+ <description>
+Avoid importing anything from the package 'java.lang'. These classes are automatically imported (JLS 7.5.3).
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+import java.lang.String; // this is unnecessary
+
+public class Foo {}
+
+// --- in another source code file...
+
+import java.lang.*; // this is bad
+
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedImports"
+ since="1.0"
+ message="Avoid unused imports such as ''{0}''"
+ class="net.sourceforge.pmd.lang.java.rule.imports.UnusedImportsRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#UnusedImports">
+ <description>
+Avoid the use of unused import statements to prevent unwanted dependencies.
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+// this is bad
+import java.io.File;
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="ImportFromSamePackage"
+ since="1.02"
+ message="No need to import a type that lives in the same package"
+ class="net.sourceforge.pmd.lang.java.rule.imports.ImportFromSamePackageRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#ImportFromSamePackage">
+ <description>
+There is no need to import a type that lives in the same package.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+ package foo;
+
+ import foo.Buz; // no need for this
+ import foo.*; // or this
+
+ public class Bar{}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="TooManyStaticImports"
+ language="java"
+ since="4.1"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ message="Too many static imports may lead to messy code"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#TooManyStaticImports">
+ <description><![CDATA[
+If you overuse the static import feature, it can make your program unreadable and
+unmaintainable, polluting its namespace with all the static members you import.
+Readers of your code (including you, a few months after you wrote it) will not know
+which class a static member comes from (Sun 1.5 Language Guide).
+ ]]></description>
+ <priority>3</priority>
+ <properties>
+ <property name="maximumStaticImports" type="Integer"
+ description="All static imports can be disallowed by setting this to 0" min="0" max="100" value="4"/>
+ <property name="xpath">
+ <value><![CDATA[
+.[count(ImportDeclaration[@Static = 'true']) > $maximumStaticImports]
+ ]]></value>
+ </property>
+ </properties>
+ <example><![CDATA[
+import static Lennon;
+import static Ringo;
+import static George;
+import static Paul;
+import static Yoko; // Too much !
+ ]]></example>
+ </rule>
+
+ <rule name="UnnecessaryFullyQualifiedName"
+ language="java"
+ since="5.0"
+ class="net.sourceforge.pmd.lang.java.rule.imports.UnnecessaryFullyQualifiedNameRule"
+ message="Unnecessary use of fully qualified name ''{0}'' due to existing import ''{1}''"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#UnnecessaryFullyQualifiedName">
+ <description><![CDATA[
+Import statements allow the use of non-fully qualified names. The use of a fully qualified name
+which is covered by an import statement is redundant. Consider using the non-fully qualified name.
+ ]]></description>
+ <priority>4</priority>
+ <example><![CDATA[
+import java.util.List;
+
+public class Foo {
+ private java.util.List list1; // Unnecessary FQN
+ private List list2; // More appropriate given import of 'java.util.List'
+}
+ ]]></example>
+ </rule>
+
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/checks/pmd-rulesets/rulesets.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/checks/pmd-rulesets/rulesets.properties b/example/application/simpleapp/modules/checks/pmd-rulesets/rulesets.properties
new file mode 100644
index 0000000..d95e632
--- /dev/null
+++ b/example/application/simpleapp/modules/checks/pmd-rulesets/rulesets.properties
@@ -0,0 +1 @@
+rulesets.filenames=rulesets/java/basic.xml,rulesets/java/imports.xml,rulesets/java/unusedcode.xml
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/checks/pmd-rulesets/unusedcode.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/checks/pmd-rulesets/unusedcode.xml b/example/application/simpleapp/modules/checks/pmd-rulesets/unusedcode.xml
new file mode 100644
index 0000000..802d18f
--- /dev/null
+++ b/example/application/simpleapp/modules/checks/pmd-rulesets/unusedcode.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+
+<ruleset name="Unused Code"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+ <description>
+The Unused Code ruleset contains rules that find unused or ineffective code.
+ </description>
+
+ <rule name="UnusedPrivateField"
+ since="0.1"
+ language="java"
+ message="Avoid unused private fields such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateFieldRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedPrivateField">
+ <description>
+Detects when a private field is declared and/or assigned a value, but not used.
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+public class Something {
+ private static int FOO = 2; // Unused
+ private int i = 5; // Unused
+ private int j = 6;
+ public int addOne() {
+ return j++;
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedLocalVariable"
+ language="java"
+ since="0.1"
+ message="Avoid unused local variables such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedLocalVariableRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedLocalVariable">
+ <description>
+Detects when a local variable is declared and/or assigned, but not used.
+ </description>
+ <priority>3</priority>
+
+ <example>
+<![CDATA[
+public class Foo {
+ public void doSomething() {
+ int i = 5; // Unused
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedPrivateMethod"
+ language="java"
+ since="0.7"
+ message="Avoid unused private methods such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateMethodRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedPrivateMethod">
+ <description>
+Unused Private Method detects when a private method is declared but is unused.
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+public class Something {
+ private void foo() {} // unused
+}
+]]>
+ </example>
+ </rule>
+
+
+ <rule name="UnusedFormalParameter"
+ language="java"
+ since="0.8"
+ message="Avoid unused {0} parameters such as ''{1}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedFormalParameterRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedFormalParameter">
+ <description>
+Avoid passing parameters to methods or constructors without actually referencing them in the method body.
+ </description>
+ <priority>3</priority>
+
+ <example>
+<![CDATA[
+public class Foo {
+ private void bar(String howdy) {
+ // howdy is not used
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedModifier"
+ language="java"
+ since="1.02"
+ message="Avoid modifiers which are implied by the context"
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedModifierRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedModifier">
+ <description>
+Fields in interfaces are automatically public static final, and methods are public abstract.
+Classes or interfaces nested in an interface are automatically public and static (all nested interfaces are automatically static).
+For historical reasons, modifiers which are implied by the context are accepted by the compiler, but are superfluous.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public interface Foo {
+ public abstract void bar(); // both abstract and public are ignored by the compiler
+ public static final int X = 0; // public, static, and final all ignored
+ public static class Bar {} // public, static ignored
+ public static interface Baz {} // ditto
+}
+public class Bar {
+ public static interface Baz {} // static ignored
+}
+ ]]>
+ </example>
+ </rule>
+ </ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/checks/pmd.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/checks/pmd.xml b/example/application/simpleapp/modules/checks/pmd.xml
new file mode 100644
index 0000000..dbaf4af
--- /dev/null
+++ b/example/application/simpleapp/modules/checks/pmd.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<ruleset name="Maven Ruleset"
+ xmlns="http://pmd.sf.net/ruleset/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
+ xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+
+ <!--
+ Customized PMD ruleset for Maven, see [0] for more information
+ [0] http://pmd.sourceforge.net/howtomakearuleset.html
+ -->
+
+ <description>
+ This ruleset checks the code for discouraged programming constructs.
+ </description>
+
+ <rule ref="pmd-rulesets/basic.xml">
+ <exclude name="EmptyCatchBlock"/>
+ </rule>
+ <rule ref="pmd-rulesets/basic.xml/EmptyCatchBlock">
+ <properties>
+ <property name="allowCommentedBlocks" value="true"/>
+ </properties>
+ </rule>
+
+ <rule ref="pmd-rulesets/unusedcode.xml"/>
+ <rule ref="pmd-rulesets/imports.xml"/>
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/checkstyle.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/checkstyle.xml b/example/application/simpleapp/modules/checkstyle.xml
deleted file mode 100644
index 033c545..0000000
--- a/example/application/simpleapp/modules/checkstyle.xml
+++ /dev/null
@@ -1,287 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
-
-<!--
-
- Checkstyle configuration that checks the sun coding conventions from:
-
- - the Java Language Specification at
- http://java.sun.com/docs/books/jls/second_edition/html/index.html
-
- - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
-
- - the Javadoc guidelines at
- http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
-
- - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
-
- - some best practices
-
- Checkstyle is very configurable. Be sure to read the documentation at
- http://checkstyle.sf.net (or in your downloaded distribution).
-
- Most Checks are configurable, be sure to consult the documentation.
-
- To completely disable a check, just comment it out or delete it from the file.
-
- Finally, it is worth reading the documentation.
-
--->
-
-<module name="Checker">
-
- <!-- Checks that a package.html file exists for each package. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
- <module name="JavadocPackage"/>
- <!--
- -->
-
- <!-- Checks whether files end with a new line. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
- <!--
- <module name="NewlineAtEndOfFile"/>
- -->
-
- <!-- Checks that property files contain the same keys. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
- <module name="Translation"/>
-
- <!--
- eg:
- //CHECKSTYLE.OFF: IllegalCatch - Much more readable than catching 7 exceptions
- catch (Exception e)
- //CHECKSTYLE.ON: IllegalCatch
- -->
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
- <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
- <property name="checkFormat" value="$1"/>
- </module>
-
- <!--
- eg:
- // CHECKSTYLE IGNORE check FOR NEXT 1 LINES
- public void onClick(View view) { ... } -->
- <module name="SuppressWithNearbyCommentFilter">
- <property name="commentFormat" value="CHECKSTYLE.IGNORE (\w+) FOR NEXT (\d+) LINES"/>
- <property name="checkFormat" value="$1"/>
- <property name="influenceFormat" value="$2"/>
- </module>
-
- <module name="TreeWalker">
-
- <property name="cacheFile" value="${checkstyle.cache.file}"/>
-
- <!-- not available in eclipse-cs
- <module name="JavadocDeprecated"/>
- -->
- <module name="MissingOverride"/>
-
- <!-- ************************************************************** -->
- <!-- Checks that are different from the sun coding conventions ones -->
- <!-- ************************************************************** -->
- <property name="tabWidth" value="4"/>
- <module name="LeftCurly">
- <property name="option" value="eol"/>
- </module>
- <module name="RightCurly">
- <property name="option" value="same"/>
- </module>
- <module name="MemberName">
- <property name="format" value="^[a-z]([a-zA-Z0-9])*$"/>
- </module>
- <module name="StaticVariableName">
- <property name="format" value="^[A-Z](_?[A-Z0-9])*$"/>
- </module>
- <module name="MethodName">
- <property name="format" value="[a-z](_?[a-zA-Z0-9]+)*$"/>
- </module>
- <module name="ParameterName">
- <property name="format" value="[a-z]([a-zA-Z0-9]+)*$"/>
- </module>
- <module name="LocalVariableName">
- <property name="format" value="[a-z]([a-zA-Z0-9]+)*$"/>
- </module>
-
- <!-- ************************************************************** -->
- <!-- Default Sun coding conventions checks -->
- <!-- ************************************************************** -->
-
- <!-- Checks for Javadoc comments. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html -->
-
- <!-- TODO: instate at some point (though only for public methods
- <module name="JavadocType"/>
- -->
- <!--
- <module name="JavadocMethod"/>
- <module name="JavadocVariable"/>
- -->
-
-
- <!-- Checks for Naming Conventions. -->
- <!-- See http://checkstyle.sf.net/config_naming.html -->
- <module name="ConstantName"/>
- <module name="PackageName"/>
- <module name="TypeName"/>
- <module name="LocalFinalVariableName"/>
-
-
- <!-- Checks for Headers -->
- <!-- See http://checkstyle.sf.net/config_header.html -->
- <!--
- <module name="Header">
- -->
- <!-- The follow property value demonstrates the ability -->
- <!-- to have access to ANT properties. In this case it uses -->
- <!-- the ${basedir} property to allow Checkstyle to be run -->
- <!-- from any directory within a project. -->
- <!--
- <property name="headerFile" value="${checkstyle.header.file}"/>
- </module>
- -->
-
- <!-- Following interprets the header file as regular expressions. -->
- <!-- <module name="RegexpHeader"/> -->
-
-
- <!-- Checks for imports -->
- <!-- See http://checkstyle.sf.net/config_import.html -->
- <module name="AvoidStarImport"/>
- <module name="IllegalImport"/>
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
-
-
- <!-- Checks for blocks. You know, those {}'s -->
- <!-- See http://checkstyle.sf.net/config_blocks.html -->
- <module name="EmptyBlock"/>
- <module name="NeedBraces"/>
- <!--
- <module name="AvoidNestedBlocks"/>
- -->
-
-
- <!-- Checks for common coding problems -->
- <!-- See http://checkstyle.sf.net/config_coding.html -->
- <module name="EmptyStatement"/>
- <module name="MagicNumber"/>
- <module name="MissingSwitchDefault"/>
- <module name="RedundantThrows"/>
- <module name="SimplifyBooleanExpression"/>
- <module name="SimplifyBooleanReturn"/>
-
- <!-- not supported in maven
- <module name="DoubleCheckedLocking"/>
- -->
- <!--
- <module name="AvoidInlineConditionals"/>
- <module name="EqualsHashCode"/>
- <module name="HiddenField"/>
- <module name="IllegalInstantiation"/>
- <module name="InnerAssignment"/>
- -->
-
- <!-- Checks for class design -->
- <!-- See http://checkstyle.sf.net/config_design.html -->
- <!--
-
- <module name="VisibilityModifier"/>
- -->
- <!-- too many violations...
- <module name="DesignForExtension"/>
- -->
- <module name="FinalClass"/>
- <module name="HideUtilityClassConstructor"/>
- <module name="InterfaceIsType"/>
-
-
- <module name="CyclomaticComplexity">
- <property name="max" value="12"/>
- </module>
- <module name="NPathComplexity">
- <property name="max" value="160"/>
- </module>
-
- <!-- Miscellaneous other checks. -->
- <!-- See http://checkstyle.sf.net/config_misc.html -->
- <!--
- <module name="ArrayTypeStyle"/>
- <module name="GenericIllegalRegexp">
- <property name="format" value="\s+$"/>
- <property name="message" value="Line has trailing spaces."/>
- </module>
- -->
- <!-- removed; we detect these in other ways.
- <module name="TodoComment"/>
- -->
- <module name="UpperEll"/>
- <module name="FinalParameters"/>
-
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <!--
- <module name="NoWhitespaceAfter"/>
- <module name="NoWhitespaceBefore"/>
- <module name="OperatorWrap"/>
- <module name="ParenPad"/>
- <module name="WhitespaceAfter"/>
- <module name="WhitespaceAround"/>
- <module name="TabCharacter"/>
- -->
- <module name="EmptyForIteratorPad"/>
-
-
- <!-- Modifier Checks -->
- <!-- See http://checkstyle.sf.net/config_modifiers.html -->
- <!--
- <module name="ModifierOrder"/>
- <module name="RedundantModifier"/>
- -->
-
- <!-- Checks for Size Violations. -->
- <!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="LineLength">
- <property name="max" value="120"/>
- </module>
- <module name="MethodLength">
- <property name="max" value="30"/>
- </module>
- <module name="ParameterNumber">
- <property name="max" value="6"/>
- </module>
-
- </module>
-
-
-
- <module name="FileLength">
- <property name="max" value="1500"/>
- </module>
-
- <module name="FileTabCharacter">
- <property name="eachLine" value="true"/>
- <property name="fileExtensions" value="java,xml"/>
- </module>
-
-</module>
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/module-simple/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/module-simple/pom.xml b/example/application/simpleapp/modules/module-simple/pom.xml
index f21dba4..a5c234a 100644
--- a/example/application/simpleapp/modules/module-simple/pom.xml
+++ b/example/application/simpleapp/modules/module-simple/pom.xml
@@ -117,10 +117,10 @@
domainapp.modules.simple.SimpleModuleManifest
</danhaywood-mavenmixin-isisvalidate>
<danhaywood-mavenmixin-staticanalysis.checkstyle.configLocation>
- ${project.basedir}/../checkstyle.xml
+ ${project.basedir}/../checks/checkstyle.xml
</danhaywood-mavenmixin-staticanalysis.checkstyle.configLocation>
<danhaywood-mavenmixin-staticanalysis.pmd.ruleset>
- ${project.basedir}/../pmd.xml
+ ${project.basedir}/../checks/pmd.xml
</danhaywood-mavenmixin-staticanalysis.pmd.ruleset>
</properties>
[05/11] isis git commit: ISIS-1538: recreating simpleapp archetype
Posted by da...@apache.org.
ISIS-1538: recreating simpleapp archetype
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/c221ea9f
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/c221ea9f
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/c221ea9f
Branch: refs/heads/maint-1.13.2
Commit: c221ea9f55810d52a145164d0032484f875b4454
Parents: 57b7111
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Nov 24 11:25:53 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 24 11:25:53 2016 +0000
----------------------------------------------------------------------
example/archetype/simpleapp/pom.xml | 3 +
.../META-INF/maven/archetype-metadata.xml | 13 +
.../archetype-resources/application/pom.xml | 32 +-
.../services/dbmanager/HsqlDbManagerMenu.java | 76 ++
.../services/homepage/HomePageService.java | 17 +-
.../application/translations.pot | 2 +-
.../archetype-resources/modules/checkstyle.xml | 290 +++++++
.../modules/module-simple/pom.xml | 54 +-
.../modules/module-simple/translations.pot | 2 +-
.../modules/pmd-rulesets/basic.xml | 810 +++++++++++++++++++
.../modules/pmd-rulesets/imports.xml | 148 ++++
.../modules/pmd-rulesets/rulesets.properties | 4 +
.../modules/pmd-rulesets/unusedcode.xml | 128 +++
.../archetype-resources/modules/pmd.xml | 49 ++
.../main/resources/archetype-resources/pom.xml | 94 ---
.../archetype-resources/webapp/pom.xml | 53 +-
.../projects/basic/archetype.properties | 2 +-
17 files changed, 1594 insertions(+), 183 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/pom.xml b/example/archetype/simpleapp/pom.xml
index 6edaf63..aec93cf 100644
--- a/example/archetype/simpleapp/pom.xml
+++ b/example/archetype/simpleapp/pom.xml
@@ -47,4 +47,7 @@
<version>1.14.0-SNAPSHOT</version>
<relativePath>../../../core/pom.xml</relativePath>
</parent>
+ <properties>
+ <archetype.test.skip>true</archetype.test.skip>
+ </properties>
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml b/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
index 8eda4b1..e8e4a02 100644
--- a/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -20,6 +20,19 @@
<archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" name="simpleapp" xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
+ <directory>modules/pmd-rulesets</directory>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>modules</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
<directory/>
<includes>
<include>pom-jdo-enhance-all.xml</include>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/application/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/pom.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/pom.xml
index a43f98f..b1542bb 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/pom.xml
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/pom.xml
@@ -71,6 +71,16 @@
<mixins>
<mixin>
<groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>standard</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>enforcerrelaxed</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
<artifactId>surefire</artifactId>
<version>0.0.2</version>
</mixin>
@@ -97,24 +107,10 @@
</dependency>
<dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-security-shiro</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-integtestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-specsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
+ <groupId>com.danhaywood.mavendeps</groupId>
+ <artifactId>isistesting</artifactId>
+ <version>0.0.2</version>
+ <type>pom</type>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/application/src/main/java/domainapp/application/services/dbmanager/HsqlDbManagerMenu.java
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/src/main/java/domainapp/application/services/dbmanager/HsqlDbManagerMenu.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/src/main/java/domainapp/application/services/dbmanager/HsqlDbManagerMenu.java
new file mode 100644
index 0000000..87d6f5e
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/src/main/java/domainapp/application/services/dbmanager/HsqlDbManagerMenu.java
@@ -0,0 +1,76 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package domainapp.application.services.dbmanager;
+
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+
+import com.google.common.base.Strings;
+
+import org.hsqldb.util.DatabaseManagerSwing;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.ActionLayout;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.annotation.RestrictTo;
+import org.apache.isis.applib.annotation.SemanticsOf;
+
+@DomainService(
+ nature = NatureOfService.VIEW_MENU_ONLY
+)
+@DomainServiceLayout(
+ named = "Prototyping",
+ menuOrder = "999",
+ menuBar = DomainServiceLayout.MenuBar.SECONDARY
+)
+public class HsqlDbManagerMenu {
+
+
+ private String url;
+
+ @PostConstruct
+ public void init(Map<String,String> properties) {
+ this.url = properties.get("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL");
+ }
+
+
+ @Action(
+ semantics = SemanticsOf.SAFE,
+ restrictTo = RestrictTo.PROTOTYPING
+ )
+ @ActionLayout(
+ named = "HSQL DB Manager",
+ cssClassFa = "database"
+ )
+ public void hsqlDbManager() {
+ String[] args = {"--url", url, "--noexit" };
+ DatabaseManagerSwing.main(args);
+ }
+ public boolean hideHsqlDbManager() {
+ return Strings.isNullOrEmpty(url) || !url.contains("hsqldb:mem");
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/application/src/main/java/domainapp/application/services/homepage/HomePageService.java
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/src/main/java/domainapp/application/services/homepage/HomePageService.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/src/main/java/domainapp/application/services/homepage/HomePageService.java
index eb30583..0ada068 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/src/main/java/domainapp/application/services/homepage/HomePageService.java
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/src/main/java/domainapp/application/services/homepage/HomePageService.java
@@ -26,29 +26,20 @@ import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.HomePage;
import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.services.registry.ServiceRegistry;
+import org.apache.isis.applib.services.factory.FactoryService;
@DomainService(
nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY // trick to suppress the actions from the top-level menu
)
public class HomePageService {
- //region > homePage (action)
-
- @Action(
- semantics = SemanticsOf.SAFE
- )
+ @Action(semantics = SemanticsOf.SAFE)
@HomePage
public HomePageViewModel homePage() {
- return serviceRegistry.injectServicesInto(new HomePageViewModel());
+ return factoryService.instantiate(HomePageViewModel.class);
}
- //endregion
-
- //region > injected services
@javax.inject.Inject
- ServiceRegistry serviceRegistry;
-
- //endregion
+ FactoryService factoryService;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
index b09ec02..96693a1 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
@@ -23,7 +23,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
-"POT-Creation-Date: 2016-11-22 11:01:18+\n"
+"POT-Creation-Date: 2016-11-24 10:28:29+\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checkstyle.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checkstyle.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checkstyle.xml
new file mode 100644
index 0000000..1d57a99
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checkstyle.xml
@@ -0,0 +1,290 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
+
+<!--
+
+ Checkstyle configuration that checks the sun coding conventions from:
+
+ - the Java Language Specification at
+ http://java.sun.com/docs/books/jls/second_edition/html/index.html
+
+ - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+
+ - the Javadoc guidelines at
+ http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+
+ - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+
+ - some best practices
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.sf.net (or in your downloaded distribution).
+
+ Most Checks are configurable, be sure to consult the documentation.
+
+ To completely disable a check, just comment it out or delete it from the file.
+
+ Finally, it is worth reading the documentation.
+
+-->
+
+<module name="Checker">
+
+ <!-- Checks that a package.html file exists for each package. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html${symbol_pound}PackageHtml -->
+ <module name="JavadocPackage"/>
+ <!--
+ -->
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html${symbol_pound}NewlineAtEndOfFile -->
+ <!--
+ <module name="NewlineAtEndOfFile"/>
+ -->
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html${symbol_pound}Translation -->
+ <module name="Translation"/>
+
+ <!--
+ eg:
+ //CHECKSTYLE.OFF: IllegalCatch - Much more readable than catching 7 exceptions
+ catch (Exception e)
+ //CHECKSTYLE.ON: IllegalCatch
+ -->
+ <module name="SuppressionCommentFilter">
+ <property name="offCommentFormat" value="CHECKSTYLE.OFF${symbol_escape}: ([${symbol_escape}w${symbol_escape}|]+)"/>
+ <property name="onCommentFormat" value="CHECKSTYLE.ON${symbol_escape}: ([${symbol_escape}w${symbol_escape}|]+)"/>
+ <property name="checkFormat" value="${symbol_dollar}1"/>
+ </module>
+
+ <!--
+ eg:
+ // CHECKSTYLE IGNORE check FOR NEXT 1 LINES
+ public void onClick(View view) { ... } -->
+ <module name="SuppressWithNearbyCommentFilter">
+ <property name="commentFormat" value="CHECKSTYLE.IGNORE (${symbol_escape}w+) FOR NEXT (${symbol_escape}d+) LINES"/>
+ <property name="checkFormat" value="${symbol_dollar}1"/>
+ <property name="influenceFormat" value="${symbol_dollar}2"/>
+ </module>
+
+ <module name="TreeWalker">
+
+ <property name="cacheFile" value="${symbol_dollar}{checkstyle.cache.file}"/>
+
+ <!-- not available in eclipse-cs
+ <module name="JavadocDeprecated"/>
+ -->
+ <module name="MissingOverride"/>
+
+ <!-- ************************************************************** -->
+ <!-- Checks that are different from the sun coding conventions ones -->
+ <!-- ************************************************************** -->
+ <property name="tabWidth" value="4"/>
+ <module name="LeftCurly">
+ <property name="option" value="eol"/>
+ </module>
+ <module name="RightCurly">
+ <property name="option" value="same"/>
+ </module>
+ <module name="MemberName">
+ <property name="format" value="^[a-z]([a-zA-Z0-9])*${symbol_dollar}"/>
+ </module>
+ <module name="StaticVariableName">
+ <property name="format" value="^[A-Z](_?[A-Z0-9])*${symbol_dollar}"/>
+ </module>
+ <module name="MethodName">
+ <property name="format" value="[a-z](_?[a-zA-Z0-9]+)*${symbol_dollar}"/>
+ </module>
+ <module name="ParameterName">
+ <property name="format" value="[a-z]([a-zA-Z0-9]+)*${symbol_dollar}"/>
+ </module>
+ <module name="LocalVariableName">
+ <property name="format" value="[a-z]([a-zA-Z0-9]+)*${symbol_dollar}"/>
+ </module>
+
+ <!-- ************************************************************** -->
+ <!-- Default Sun coding conventions checks -->
+ <!-- ************************************************************** -->
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+
+ <!-- TODO: instate at some point (though only for public methods
+ <module name="JavadocType"/>
+ -->
+ <!--
+ <module name="JavadocMethod"/>
+ <module name="JavadocVariable"/>
+ -->
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName"/>
+ <module name="PackageName"/>
+ <module name="TypeName"/>
+ <module name="LocalFinalVariableName"/>
+
+
+ <!-- Checks for Headers -->
+ <!-- See http://checkstyle.sf.net/config_header.html -->
+ <!--
+ <module name="Header">
+ -->
+ <!-- The follow property value demonstrates the ability -->
+ <!-- to have access to ANT properties. In this case it uses -->
+ <!-- the ${symbol_dollar}{basedir} property to allow Checkstyle to be run -->
+ <!-- from any directory within a project. -->
+ <!--
+ <property name="headerFile" value="${symbol_dollar}{checkstyle.header.file}"/>
+ </module>
+ -->
+
+ <!-- Following interprets the header file as regular expressions. -->
+ <!-- <module name="RegexpHeader"/> -->
+
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport"/>
+ <module name="IllegalImport"/>
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="EmptyBlock"/>
+ <module name="NeedBraces"/>
+ <!--
+ <module name="AvoidNestedBlocks"/>
+ -->
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <module name="EmptyStatement"/>
+ <module name="MagicNumber"/>
+ <module name="MissingSwitchDefault"/>
+ <module name="RedundantThrows"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+
+ <!-- not supported in maven
+ <module name="DoubleCheckedLocking"/>
+ -->
+ <!--
+ <module name="AvoidInlineConditionals"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField"/>
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+ -->
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!--
+
+ <module name="VisibilityModifier"/>
+ -->
+ <!-- too many violations...
+ <module name="DesignForExtension"/>
+ -->
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ <module name="InterfaceIsType"/>
+
+
+ <module name="CyclomaticComplexity">
+ <property name="max" value="12"/>
+ </module>
+ <module name="NPathComplexity">
+ <property name="max" value="160"/>
+ </module>
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <!--
+ <module name="ArrayTypeStyle"/>
+ <module name="GenericIllegalRegexp">
+ <property name="format" value="${symbol_escape}s+${symbol_dollar}"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+ -->
+ <!-- removed; we detect these in other ways.
+ <module name="TodoComment"/>
+ -->
+ <module name="UpperEll"/>
+ <module name="FinalParameters"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <!--
+ <module name="NoWhitespaceAfter"/>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+ <module name="TabCharacter"/>
+ -->
+ <module name="EmptyForIteratorPad"/>
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <!--
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+ -->
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="LineLength">
+ <property name="max" value="120"/>
+ </module>
+ <module name="MethodLength">
+ <property name="max" value="30"/>
+ </module>
+ <module name="ParameterNumber">
+ <property name="max" value="6"/>
+ </module>
+
+ </module>
+
+
+
+ <module name="FileLength">
+ <property name="max" value="1500"/>
+ </module>
+
+ <module name="FileTabCharacter">
+ <property name="eachLine" value="true"/>
+ <property name="fileExtensions" value="java,xml"/>
+ </module>
+
+</module>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/pom.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/pom.xml
index 4a03b6d..a131ff8 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/pom.xml
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/pom.xml
@@ -68,6 +68,16 @@
<mixins>
<mixin>
<groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>standard</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>enforcerrelaxed</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
<artifactId>datanucleusenhance</artifactId>
<version>0.0.2</version>
</mixin>
@@ -81,6 +91,16 @@
<artifactId>surefire</artifactId>
<version>0.0.2</version>
</mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>sourceandjavadoc</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>staticanalysis</artifactId>
+ <version>0.0.1</version>
+ </mixin>
</mixins>
</configuration>
</plugin>
@@ -89,6 +109,8 @@
<properties>
<danhaywood-mavenmixin-isisvalidate>domainapp.modules.simple.SimpleModuleManifest</danhaywood-mavenmixin-isisvalidate>
+ <danhaywood-mavenmixin-staticanalysis.checkstyle.configLocation>${project.basedir}/../checkstyle.xml</danhaywood-mavenmixin-staticanalysis.checkstyle.configLocation>
+ <danhaywood-mavenmixin-staticanalysis.pmd.ruleset>${project.basedir}/../pmd.xml</danhaywood-mavenmixin-staticanalysis.pmd.ruleset>
</properties>
<dependencies>
@@ -98,34 +120,10 @@
</dependency>
<dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-integtestsupport</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-specsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.objenesis</groupId>
- <artifactId>objenesis</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
+ <groupId>com.danhaywood.mavendeps</groupId>
+ <artifactId>isistesting</artifactId>
+ <version>0.0.2</version>
+ <type>pom</type>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
index 2f23d9c..f17494e 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
@@ -23,7 +23,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
-"POT-Creation-Date: 2016-11-22 11:01:11+\n"
+"POT-Creation-Date: 2016-11-24 10:28:23+\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/basic.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/basic.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/basic.xml
new file mode 100644
index 0000000..4ee44b0
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/basic.xml
@@ -0,0 +1,810 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0"?>
+
+<ruleset name="Basic"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+ <description>
+The Basic ruleset contains a collection of good practices which should be followed.
+ </description>
+
+ <rule name="JumbledIncrementer"
+ language="java"
+ since="1.0"
+ message="Avoid modifying an outer loop incrementer in an inner loop for update expression"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}JumbledIncrementer">
+ <description>
+Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ForStatement
+ [
+ ForUpdate/StatementExpressionList/StatementExpression/PostfixExpression/PrimaryExpression/PrimaryPrefix/Name/@Image
+ =
+ ancestor::ForStatement/ForInit//VariableDeclaratorId/@Image
+ ]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class JumbledIncrementerRule1 {
+ public void foo() {
+ for (int i = 0; i < 10; i++) { // only references 'i'
+ for (int k = 0; k < 20; i++) { // references both 'i' and 'k'
+ System.out.println("Hello");
+ }
+ }
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ForLoopShouldBeWhileLoop"
+ language="java"
+ since="1.02"
+ message="This for loop could be simplified to a while loop"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ForLoopShouldBeWhileLoop">
+ <description>
+Some for loops can be simplified to while loops, this makes them more concise.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ForStatement
+ [count(*) > 1]
+ [not(LocalVariableDeclaration)]
+ [not(ForInit)]
+ [not(ForUpdate)]
+ [not(Type and Expression and Statement)]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ void bar() {
+ for (;true;) true; // No Init or Update part, may as well be: while (true)
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="OverrideBothEqualsAndHashcode"
+ language="java"
+ since="0.4"
+ message="Ensure you override both equals() and hashCode()"
+ class="net.sourceforge.pmd.lang.java.rule.basic.OverrideBothEqualsAndHashcodeRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}OverrideBothEqualsAndHashcode">
+ <description>
+Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public class Bar { // poor, missing a hashcode() method
+ public boolean equals(Object o) {
+ // do some comparison
+ }
+}
+
+public class Baz { // poor, missing an equals() method
+ public int hashCode() {
+ // return some hash value
+ }
+}
+
+public class Foo { // perfect, both methods provided
+ public boolean equals(Object other) {
+ // do some comparison
+ }
+ public int hashCode() {
+ // return some hash value
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="DoubleCheckedLocking"
+ language="java"
+ since="1.04"
+ message="Double checked locking is not thread safe in Java."
+ class="net.sourceforge.pmd.lang.java.rule.basic.DoubleCheckedLockingRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}DoubleCheckedLocking">
+ <description>
+Partially created objects can be returned by the Double Checked Locking pattern when used in Java.
+An optimizing JRE may assign a reference to the baz variable before it creates the object the
+reference is intended to point to.
+
+For more details refer to: http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html
+ </description>
+ <priority>1</priority>
+ <example>
+ <![CDATA[
+public class Foo {
+ Object baz;
+ Object bar() {
+ if (baz == null) { // baz may be non-null yet not fully created
+ synchronized(this) {
+ if (baz == null) {
+ baz = new Object();
+ }
+ }
+ }
+ return baz;
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ReturnFromFinallyBlock"
+ language="java"
+ since="1.05"
+ message="Avoid returning from a finally block"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ReturnFromFinallyBlock">
+ <description>
+Avoid returning from a finally block, this can discard exceptions.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//FinallyStatement//ReturnStatement
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Bar {
+ public String foo() {
+ try {
+ throw new Exception( "My Exception" );
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ return "A. O. K."; // return not recommended here
+ }
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnconditionalIfStatement"
+ language="java"
+ since="1.5"
+ message="Do not use 'if' statements that are always true or always false"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}UnconditionalIfStatement">
+ <description>
+Do not use "if" statements whose conditionals are always true or always false.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//IfStatement/Expression
+ [count(PrimaryExpression)=1]
+ /PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ public void close() {
+ if (true) { // fixed conditional, not recommended
+ // ...
+ }
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="BooleanInstantiation"
+ since="1.2"
+ message="Avoid instantiating Boolean objects; reference Boolean.TRUE or Boolean.FALSE or call Boolean.valueOf() instead."
+ class="net.sourceforge.pmd.lang.java.rule.basic.BooleanInstantiationRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}BooleanInstantiation">
+ <description>
+Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boolean.valueOf() instead.
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+Boolean bar = new Boolean("true"); // unnecessary creation, just reference Boolean.TRUE;
+Boolean buz = Boolean.valueOf(false); // ...., just reference Boolean.FALSE;
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="CollapsibleIfStatements"
+ language="java"
+ since="3.1"
+ message="These nested if statements could be combined"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}CollapsibleIfStatements">
+ <description>
+Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//IfStatement[@Else='false']/Statement
+ /IfStatement[@Else='false']
+ |
+//IfStatement[@Else='false']/Statement
+ /Block[count(BlockStatement)=1]/BlockStatement
+ /Statement/IfStatement[@Else='false']]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+void bar() {
+ if (x) { // original implementation
+ if (y) {
+ // do stuff
+ }
+ }
+}
+
+void bar() {
+ if (x && y) { // optimized implementation
+ // do stuff
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ClassCastExceptionWithToArray"
+ language="java"
+ since="3.4"
+ message="This usage of the Collection.toArray() method will throw a ClassCastException."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ClassCastExceptionWithToArray">
+ <description>
+When deriving an array of a specific class from your Collection, one should provide an array of
+the same class as the parameter of the toArray() method. Doing otherwise you will will result
+in a ClassCastException.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//CastExpression[Type/ReferenceType/ClassOrInterfaceType[@Image !=
+"Object"]]/PrimaryExpression
+[
+ PrimaryPrefix/Name[ends-with(@Image, '.toArray')]
+ and
+ PrimarySuffix/Arguments[count(*) = 0]
+and
+count(PrimarySuffix) = 1
+]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+Collection c = new ArrayList();
+Integer obj = new Integer(1);
+c.add(obj);
+
+ // this would trigger the rule (and throw a ClassCastException if executed)
+Integer[] a = (Integer [])c.toArray();
+
+ // this is fine and will not trigger the rule
+Integer[] b = (Integer [])c.toArray(new Integer[c.size()]);
+]]>
+ </example>
+</rule>
+
+
+<rule name="AvoidDecimalLiteralsInBigDecimalConstructor"
+ language="java"
+ since="3.4"
+ message="Avoid creating BigDecimal with a decimal (float/double) literal. Use a String literal"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidDecimalLiteralsInBigDecimalConstructor">
+ <description>
+One might assume that the result of "new BigDecimal(0.1)" is exactly equal to 0.1, but it is actually
+equal to .1000000000000000055511151231257827021181583404541015625.
+This is because 0.1 cannot be represented exactly as a double (or as a binary fraction of any finite
+length). Thus, the long value that is being passed in to the constructor is not exactly equal to 0.1,
+appearances notwithstanding.
+
+The (String) constructor, on the other hand, is perfectly predictable: 'new BigDecimal("0.1")' is
+exactly equal to 0.1, as one would expect. Therefore, it is generally recommended that the
+(String) constructor be used in preference to this one.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//AllocationExpression[ClassOrInterfaceType[@Image="BigDecimal"]
+and
+./Arguments/ArgumentList
+/Expression/PrimaryExpression/PrimaryPrefix/Literal[(not
+(ends-with
+(@Image,'"'))) and contains(@Image,".")]]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+BigDecimal bd = new BigDecimal(1.123); // loss of precision, this would trigger the rule
+
+BigDecimal bd = new BigDecimal("1.123"); // preferred approach
+
+BigDecimal bd = new BigDecimal(12); // preferred approach, ok for integer values
+]]>
+ </example>
+</rule>
+
+
+ <rule name="MisplacedNullCheck"
+ language="java"
+ since="3.5"
+ message="The null check here is misplaced; if the variable is null there'll be a NullPointerException"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}MisplacedNullCheck">
+ <description>
+The null check here is misplaced. If the variable is null a NullPointerException will be thrown.
+Either the check is useless (the variable will never be "null") or it is incorrect.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//Expression
+ /*[self::ConditionalOrExpression or self::ConditionalAndExpression]
+ /descendant::PrimaryExpression/PrimaryPrefix
+ /Name[starts-with(@Image,
+ concat(ancestor::PrimaryExpression/following-sibling::EqualityExpression
+ [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
+ /PrimaryExpression/PrimaryPrefix
+ /Name[count(../../PrimarySuffix)=0]/@Image,".")
+ )
+ ]
+ [count(ancestor::ConditionalAndExpression/EqualityExpression
+ [@Image='!=']
+ [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
+ [starts-with(following-sibling::*/PrimaryExpression/PrimaryPrefix/Name/@Image,
+ concat(./PrimaryExpression/PrimaryPrefix/Name/@Image, '.'))]
+ ) = 0
+ ]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ void bar() {
+ if (a.equals(baz) && a != null) {}
+ }
+}
+ ]]>
+ </example>
+ <example><![CDATA[
+public class Foo {
+ void bar() {
+ if (a.equals(baz) || a == null) {}
+ }
+}
+ ]]></example>
+ </rule>
+
+
+ <rule name="AvoidThreadGroup"
+ language="java"
+ since="3.6"
+ message="Avoid using java.lang.ThreadGroup; it is not thread safe"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidThreadGroup"
+ typeResolution="true">
+ <description>
+Avoid using java.lang.ThreadGroup; although it is intended to be used in a threaded environment
+it contains methods that are not thread-safe.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//AllocationExpression/ClassOrInterfaceType[pmd-java:typeof(@Image, 'java.lang.ThreadGroup')]|
+//PrimarySuffix[contains(@Image, 'getThreadGroup')]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Bar {
+ void buz() {
+ ThreadGroup tg = new ThreadGroup("My threadgroup") ;
+ tg = new ThreadGroup(tg, "my thread group");
+ tg = Thread.currentThread().getThreadGroup();
+ tg = System.getSecurityManager().getThreadGroup();
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="BrokenNullCheck"
+ since="3.8"
+ message="Method call on object which may be null"
+ class="net.sourceforge.pmd.lang.java.rule.basic.BrokenNullCheckRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}BrokenNullCheck">
+ <description>
+The null check is broken since it will throw a NullPointerException itself.
+It is likely that you used || instead of && or vice versa.
+ </description>
+ <priority>2</priority>
+ <example>
+<![CDATA[
+public String bar(String string) {
+ // should be &&
+ if (string!=null || !string.equals(""))
+ return string;
+ // should be ||
+ if (string==null && string.equals(""))
+ return string;
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="BigIntegerInstantiation"
+ since="3.9"
+ message="Don't create instances of already existing BigInteger and BigDecimal (ZERO, ONE, TEN)"
+ class="net.sourceforge.pmd.lang.java.rule.basic.BigIntegerInstantiationRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}BigIntegerInstantiation">
+ <description>
+Don't create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) and
+for Java 1.5 onwards, BigInteger.TEN and BigDecimal (BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN)
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+BigInteger bi = new BigInteger(1); // reference BigInteger.ONE instead
+BigInteger bi2 = new BigInteger("0"); // reference BigInteger.ZERO instead
+BigInteger bi3 = new BigInteger(0.0); // reference BigInteger.ZERO instead
+BigInteger bi4;
+bi4 = new BigInteger(0); // reference BigInteger.ZERO instead
+]]>
+ </example>
+</rule>
+
+ <rule name="AvoidUsingOctalValues"
+ since="3.9"
+ message="Do not start a literal by 0 unless it's an octal value"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingOctalValuesRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidUsingOctalValues">
+ <description>
+ <![CDATA[
+Integer literals should not start with zero since this denotes that the rest of literal will be
+interpreted as an octal value.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+int i = 012; // set i with 10 not 12
+int j = 010; // set j with 8 not 10
+k = i * j; // set k with 80 not 120
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="AvoidUsingHardCodedIP"
+ since="4.1"
+ message="Do not hard code the IP address ${symbol_dollar}{variableName}"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingHardCodedIPRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidUsingHardCodedIP">
+ <description>
+ <![CDATA[
+Application with hard-coded IP addresses can become impossible to deploy in some cases.
+Externalizing IP adresses is preferable.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="pattern" type="String" description="Regular Expression" value='^"[0-9]{1,3}${symbol_escape}.[0-9]{1,3}${symbol_escape}.[0-9]{1,3}${symbol_escape}.[0-9]{1,3}"${symbol_dollar}'/>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ private String ip = "127.0.0.1"; // not recommended
+}
+ ]]>
+ </example>
+ </rule>
+
+ <!--
+ not available in maven-pmd-plugin ???
+ <rule name="CheckResultSet"
+ language="java"
+ since="4.1"
+ class="net.sourceforge.pmd.lang.java.rule.basic.CheckResultSetRule"
+ message="Always check the return of one of the navigation method (next,previous,first,last) of a ResultSet."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}CheckResultSet">
+ <description>
+ <![CDATA[
+Always check the return values of navigation methods (next, previous, first, last) of a ResultSet.
+If the value return is 'false', it should be handled properly.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+Statement stat = conn.createStatement();
+ResultSet rst = stat.executeQuery("SELECT name FROM person");
+rst.next(); // what if it returns false? bad form
+String firstName = rst.getString(1);
+
+Statement stat = conn.createStatement();
+ResultSet rst = stat.executeQuery("SELECT name FROM person");
+if (rst.next()) { // result is properly examined and used
+ String firstName = rst.getString(1);
+ } else {
+ // handle missing data
+}
+ ]]>
+ </example>
+ </rule>
+ -->
+
+ <rule name="AvoidMultipleUnaryOperators"
+ since="4.2"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidMultipleUnaryOperatorsRule"
+ message="Using multiple unary operators may be a bug, and/or is confusing."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidMultipleUnaryOperators">
+ <description>
+ <![CDATA[
+The use of multiple unary operators may be problematic, and/or confusing.
+Ensure that the intended usage is not a bug, or consider simplifying the expression.
+ ]]>
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+// These are typo bugs, or at best needlessly complex and confusing:
+int i = - -1;
+int j = + - +1;
+int z = ~~2;
+boolean b = !!true;
+boolean c = !!!true;
+
+// These are better:
+int i = 1;
+int j = -1;
+int z = 2;
+boolean b = true;
+boolean c = false;
+
+// And these just make your brain hurt:
+int i = ~-2;
+int j = -~7;
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ExtendsObject"
+ language="java"
+ since="5.0"
+ message="No need to explicitly extend Object."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ExtendsObject">
+ <description>No need to explicitly extend Object.</description>
+ <priority>4</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ExtendsList/ClassOrInterfaceType[@Image='Object' or @Image='java.lang.Object']
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo extends Object { // not required
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="CheckSkipResult"
+ language="java"
+ since="5.0"
+ message="Check the value returned by the skip() method of an InputStream to see if the requested number of bytes has been skipped."
+ class="net.sourceforge.pmd.lang.java.rule.basic.CheckSkipResultRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}CheckSkipResult">
+ <description>The skip() method may skip a smaller number of bytes than requested. Check the returned value to find out if it was the case or not.</description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public class Foo {
+
+ private FileInputStream _s = new FileInputStream("file");
+
+ public void skip(int n) throws IOException {
+ _s.skip(n); // You are not sure that exactly n bytes are skipped
+ }
+
+ public void skipExactly(int n) throws IOException {
+ while (n != 0) {
+ long skipped = _s.skip(n);
+ if (skipped == 0)
+ throw new EOFException();
+ n -= skipped;
+ }
+ }
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="AvoidBranchingStatementAsLastInLoop"
+ since="5.0"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidBranchingStatementAsLastInLoopRule"
+ message="Avoid using a branching statement as the last in a loop."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidBranchingStatementAsLastInLoop">
+ <description>
+ <![CDATA[
+Using a branching statement as the last part of a loop may be a bug, and/or is confusing.
+Ensure that the usage is not a bug, or consider using another approach.
+ ]]>
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+ // unusual use of branching statement in a loop
+for (int i = 0; i < 10; i++) {
+ if (i*i <= 25) {
+ continue;
+ }
+ break;
+}
+
+ // this makes more sense...
+for (int i = 0; i < 10; i++) {
+ if (i*i > 25) {
+ break;
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="DontCallThreadRun"
+ language="java"
+ since="4.3"
+ message="Don't call Thread.run() explicitly, use Thread.start()"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}DontCallThreadRun">
+ <description>
+Explicitly calling Thread.run() method will execute in the caller's thread of control. Instead, call Thread.start() for the intended behavior.
+ </description>
+ <priority>4</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//StatementExpression/PrimaryExpression
+[
+ PrimaryPrefix
+ [
+ ./Name[ends-with(@Image, '.run') or @Image = 'run']
+ and substring-before(Name/@Image, '.') =//VariableDeclarator/VariableDeclaratorId/@Image
+ [../../../Type/ReferenceType[ClassOrInterfaceType/@Image = 'Thread']]
+ or (
+ ./AllocationExpression/ClassOrInterfaceType[@Image = 'Thread']
+ and ../PrimarySuffix[@Image = 'run'])
+ ]
+]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+Thread t = new Thread();
+t.run(); // use t.start() instead
+new Thread().run(); // same violation
+]]>
+ </example>
+ </rule>
+
+ <rule name="DontUseFloatTypeForLoopIndices"
+ language="java"
+ since="4.3"
+ message="Don't use floating point for loop indices. If you must use floating point, use double."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}DontUseFloatTypeForLoopIndices">
+ <description>
+Don't use floating point for loop indices. If you must use floating point, use double
+unless you're certain that float provides enough precision and you have a compelling
+performance need (space or time).
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//ForStatement/ForInit/LocalVariableDeclaration
+/Type/PrimitiveType[@Image="float"]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+public class Count {
+ public static void main(String[] args) {
+ final int START = 2000000000;
+ int count = 0;
+ for (float f = START; f < START + 50; f++)
+ count++;
+ //Prints 0 because (float) START == (float) (START + 50).
+ System.out.println(count);
+ //The termination test misbehaves due to floating point granularity.
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyCatchBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyIfStmt" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyWhileStmt" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyTryBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyFinallyBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySwitchStatements" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySynchronizedBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementNotInLoop" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyInitializer" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStaticInitializer" />
+
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryConversionTemporary" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryReturn" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryFinalModifier" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOverridingMethod" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOperationOnImmutable" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnusedNullCheckInEquals" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessParentheses" />
+
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/imports.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/imports.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/imports.xml
new file mode 100644
index 0000000..28fc2a2
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/imports.xml
@@ -0,0 +1,148 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0"?>
+
+<ruleset name="Import Statements"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+
+ <description>
+These rules deal with different problems that can occur with import statements.
+ </description>
+
+ <rule name="DuplicateImports"
+ since="0.5"
+ message="Avoid duplicate imports such as ''{0}''"
+ class="net.sourceforge.pmd.lang.java.rule.imports.DuplicateImportsRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}DuplicateImports">
+ <description>
+Duplicate or overlapping import statements should be avoided.
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+import java.lang.String;
+import java.lang.*;
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="DontImportJavaLang"
+ since="0.5"
+ message="Avoid importing anything from the package 'java.lang'"
+ class="net.sourceforge.pmd.lang.java.rule.imports.DontImportJavaLangRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}DontImportJavaLang">
+ <description>
+Avoid importing anything from the package 'java.lang'. These classes are automatically imported (JLS 7.5.3).
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+import java.lang.String; // this is unnecessary
+
+public class Foo {}
+
+// --- in another source code file...
+
+import java.lang.*; // this is bad
+
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedImports"
+ since="1.0"
+ message="Avoid unused imports such as ''{0}''"
+ class="net.sourceforge.pmd.lang.java.rule.imports.UnusedImportsRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}UnusedImports">
+ <description>
+Avoid the use of unused import statements to prevent unwanted dependencies.
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+// this is bad
+import java.io.File;
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="ImportFromSamePackage"
+ since="1.02"
+ message="No need to import a type that lives in the same package"
+ class="net.sourceforge.pmd.lang.java.rule.imports.ImportFromSamePackageRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}ImportFromSamePackage">
+ <description>
+There is no need to import a type that lives in the same package.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+ package foo;
+
+ import foo.Buz; // no need for this
+ import foo.*; // or this
+
+ public class Bar{}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="TooManyStaticImports"
+ language="java"
+ since="4.1"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ message="Too many static imports may lead to messy code"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}TooManyStaticImports">
+ <description><![CDATA[
+If you overuse the static import feature, it can make your program unreadable and
+unmaintainable, polluting its namespace with all the static members you import.
+Readers of your code (including you, a few months after you wrote it) will not know
+which class a static member comes from (Sun 1.5 Language Guide).
+ ]]></description>
+ <priority>3</priority>
+ <properties>
+ <property name="maximumStaticImports" type="Integer"
+ description="All static imports can be disallowed by setting this to 0" min="0" max="100" value="4"/>
+ <property name="xpath">
+ <value><![CDATA[
+.[count(ImportDeclaration[@Static = 'true']) > ${symbol_dollar}maximumStaticImports]
+ ]]></value>
+ </property>
+ </properties>
+ <example><![CDATA[
+import static Lennon;
+import static Ringo;
+import static George;
+import static Paul;
+import static Yoko; // Too much !
+ ]]></example>
+ </rule>
+
+ <rule name="UnnecessaryFullyQualifiedName"
+ language="java"
+ since="5.0"
+ class="net.sourceforge.pmd.lang.java.rule.imports.UnnecessaryFullyQualifiedNameRule"
+ message="Unnecessary use of fully qualified name ''{0}'' due to existing import ''{1}''"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}UnnecessaryFullyQualifiedName">
+ <description><![CDATA[
+Import statements allow the use of non-fully qualified names. The use of a fully qualified name
+which is covered by an import statement is redundant. Consider using the non-fully qualified name.
+ ]]></description>
+ <priority>4</priority>
+ <example><![CDATA[
+import java.util.List;
+
+public class Foo {
+ private java.util.List list1; // Unnecessary FQN
+ private List list2; // More appropriate given import of 'java.util.List'
+}
+ ]]></example>
+ </rule>
+
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/rulesets.properties
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/rulesets.properties b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/rulesets.properties
new file mode 100644
index 0000000..0a1c2d3
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/rulesets.properties
@@ -0,0 +1,4 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+rulesets.filenames=rulesets/java/basic.xml,rulesets/java/imports.xml,rulesets/java/unusedcode.xml
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/unusedcode.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/unusedcode.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/unusedcode.xml
new file mode 100644
index 0000000..6e3d178
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/unusedcode.xml
@@ -0,0 +1,128 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0"?>
+
+<ruleset name="Unused Code"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+ <description>
+The Unused Code ruleset contains rules that find unused or ineffective code.
+ </description>
+
+ <rule name="UnusedPrivateField"
+ since="0.1"
+ language="java"
+ message="Avoid unused private fields such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateFieldRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedPrivateField">
+ <description>
+Detects when a private field is declared and/or assigned a value, but not used.
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+public class Something {
+ private static int FOO = 2; // Unused
+ private int i = 5; // Unused
+ private int j = 6;
+ public int addOne() {
+ return j++;
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedLocalVariable"
+ language="java"
+ since="0.1"
+ message="Avoid unused local variables such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedLocalVariableRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedLocalVariable">
+ <description>
+Detects when a local variable is declared and/or assigned, but not used.
+ </description>
+ <priority>3</priority>
+
+ <example>
+<![CDATA[
+public class Foo {
+ public void doSomething() {
+ int i = 5; // Unused
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedPrivateMethod"
+ language="java"
+ since="0.7"
+ message="Avoid unused private methods such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateMethodRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedPrivateMethod">
+ <description>
+Unused Private Method detects when a private method is declared but is unused.
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+public class Something {
+ private void foo() {} // unused
+}
+]]>
+ </example>
+ </rule>
+
+
+ <rule name="UnusedFormalParameter"
+ language="java"
+ since="0.8"
+ message="Avoid unused {0} parameters such as ''{1}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedFormalParameterRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedFormalParameter">
+ <description>
+Avoid passing parameters to methods or constructors without actually referencing them in the method body.
+ </description>
+ <priority>3</priority>
+
+ <example>
+<![CDATA[
+public class Foo {
+ private void bar(String howdy) {
+ // howdy is not used
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedModifier"
+ language="java"
+ since="1.02"
+ message="Avoid modifiers which are implied by the context"
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedModifierRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedModifier">
+ <description>
+Fields in interfaces are automatically public static final, and methods are public abstract.
+Classes or interfaces nested in an interface are automatically public and static (all nested interfaces are automatically static).
+For historical reasons, modifiers which are implied by the context are accepted by the compiler, but are superfluous.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public interface Foo {
+ public abstract void bar(); // both abstract and public are ignored by the compiler
+ public static final int X = 0; // public, static, and final all ignored
+ public static class Bar {} // public, static ignored
+ public static interface Baz {} // ditto
+}
+public class Bar {
+ public static interface Baz {} // static ignored
+}
+ ]]>
+ </example>
+ </rule>
+ </ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd.xml
new file mode 100644
index 0000000..ac23283
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd.xml
@@ -0,0 +1,49 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<ruleset name="Maven Ruleset"
+ xmlns="http://pmd.sf.net/ruleset/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
+ xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+
+ <!--
+ Customized PMD ruleset for Maven, see [0] for more information
+ [0] http://pmd.sourceforge.net/howtomakearuleset.html
+ -->
+
+ <description>
+ This ruleset checks the code for discouraged programming constructs.
+ </description>
+
+ <rule ref="pmd-rulesets/basic.xml">
+ <exclude name="EmptyCatchBlock"/>
+ </rule>
+ <rule ref="pmd-rulesets/basic.xml/EmptyCatchBlock">
+ <properties>
+ <property name="allowCommentedBlocks" value="true"/>
+ </properties>
+ </rule>
+
+ <rule ref="pmd-rulesets/unusedcode.xml"/>
+ <rule ref="pmd-rulesets/imports.xml"/>
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
index adcff7f..c4cabe1 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
@@ -63,100 +63,6 @@
</repository>
</repositories>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <version>1.3.1</version>
- <configuration>
- <rules>
- <requireMavenVersion>
- <version>[3.2.1,)</version>
- </requireMavenVersion>
- <requireJavaVersion>
- <version>[1.8.0,)</version>
- </requireJavaVersion>
- <requirePluginVersions>
- <message>All plugin versions must be defined!</message>
- <banLatest>true</banLatest>
- <banRelease>true</banRelease>
- </requirePluginVersions>
- <DependencyConvergence />
- </rules>
- </configuration>
- <executions>
- <execution>
- <id>validate-enforce</id>
- <phase>validate</phase>
- <goals>
- <goal>enforce</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- <compilerArgument>-parameters</compilerArgument>
- </configuration>
- <executions>
- <execution>
- <id>source</id>
- <phase>compile</phase>
- </execution>
- <execution>
- <id>test</id>
- <phase>test-compile</phase>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.5</version>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
- </plugin>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <version>2.5.1</version>
- </plugin>
- <plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.8.1</version>
- </plugin>
- <plugin>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.3</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
<dependencyManagement>
<dependencies>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/main/resources/archetype-resources/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/webapp/pom.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/webapp/pom.xml
index 4fc9582..b0719b5 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/webapp/pom.xml
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/webapp/pom.xml
@@ -36,6 +36,9 @@
<danhaywood-mavenmixin-isisswagger.appManifest>domainapp.application.manifest.DomainAppAppManifest</danhaywood-mavenmixin-isisswagger.appManifest>
<danhaywood-mavenmixin-isisswagger.dependency.artifactId>${project.parent.artifactId}-application</danhaywood-mavenmixin-isisswagger.dependency.artifactId>
<danhaywood-mavenmixin-jettywar.warName>${project.parent.artifactId}</danhaywood-mavenmixin-jettywar.warName>
+
+ <danhaywood-mavenmixin-jettyconsole.backgroundImage>${basedir}/src/main/jettyconsole/isis-banner.png</danhaywood-mavenmixin-jettyconsole.backgroundImage>
+
</properties>
<build>
@@ -76,6 +79,16 @@
<mixins>
<mixin>
<groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>standard</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>enforcerrelaxed</artifactId>
+ <version>0.0.1</version>
+ </mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
<artifactId>isisswagger</artifactId>
<version>0.0.2</version>
</mixin>
@@ -84,6 +97,11 @@
<artifactId>jettywar</artifactId>
<version>0.0.1</version>
</mixin>
+ <mixin>
+ <groupId>com.danhaywood.mavenmixin</groupId>
+ <artifactId>jettyconsole</artifactId>
+ <version>0.0.1</version>
+ </mixin>
</mixins>
</configuration>
</plugin>
@@ -97,21 +115,17 @@
</dependency>
<dependency>
- <groupId>org.apache.isis.viewer</groupId>
- <artifactId>isis-viewer-wicket-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-viewer-restfulobjects-server</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-security-shiro</artifactId>
+ <groupId>com.danhaywood.mavendeps</groupId>
+ <artifactId>isiswebapp</artifactId>
+ <version>0.0.1</version>
+ <type>pom</type>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <groupId>com.danhaywood.mavendeps</groupId>
+ <artifactId>isisintellij</artifactId>
+ <version>0.0.1</version>
+ <type>pom</type>
</dependency>
</dependencies>
@@ -192,21 +206,6 @@
</dependencies>
</profile>
-->
-
- <profile>
- <id>intellij</id>
- <activation>
- <property>
- <name>idea.version</name>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-webserver</artifactId>
- </dependency>
- </dependencies>
- </profile>
</profiles>
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/c221ea9f/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties b/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
index 5ee2f0f..0055a6f 100644
--- a/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
+++ b/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
@@ -1,4 +1,4 @@
-#Tue Nov 22 11:04:35 GMT 2016
+#Thu Nov 24 11:25:49 GMT 2016
package=it.pkg
version=0.1-SNAPSHOT
groupId=archetype.it
[08/11] isis git commit: ISIS-1538: recreating simpleapp archetype
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/basic.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/basic.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/basic.xml
deleted file mode 100644
index 4ee44b0..0000000
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/basic.xml
+++ /dev/null
@@ -1,810 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-<?xml version="1.0"?>
-
-<ruleset name="Basic"
- xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
- <description>
-The Basic ruleset contains a collection of good practices which should be followed.
- </description>
-
- <rule name="JumbledIncrementer"
- language="java"
- since="1.0"
- message="Avoid modifying an outer loop incrementer in an inner loop for update expression"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}JumbledIncrementer">
- <description>
-Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//ForStatement
- [
- ForUpdate/StatementExpressionList/StatementExpression/PostfixExpression/PrimaryExpression/PrimaryPrefix/Name/@Image
- =
- ancestor::ForStatement/ForInit//VariableDeclaratorId/@Image
- ]
- ]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class JumbledIncrementerRule1 {
- public void foo() {
- for (int i = 0; i < 10; i++) { // only references 'i'
- for (int k = 0; k < 20; i++) { // references both 'i' and 'k'
- System.out.println("Hello");
- }
- }
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="ForLoopShouldBeWhileLoop"
- language="java"
- since="1.02"
- message="This for loop could be simplified to a while loop"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ForLoopShouldBeWhileLoop">
- <description>
-Some for loops can be simplified to while loops, this makes them more concise.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//ForStatement
- [count(*) > 1]
- [not(LocalVariableDeclaration)]
- [not(ForInit)]
- [not(ForUpdate)]
- [not(Type and Expression and Statement)]
- ]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Foo {
- void bar() {
- for (;true;) true; // No Init or Update part, may as well be: while (true)
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="OverrideBothEqualsAndHashcode"
- language="java"
- since="0.4"
- message="Ensure you override both equals() and hashCode()"
- class="net.sourceforge.pmd.lang.java.rule.basic.OverrideBothEqualsAndHashcodeRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}OverrideBothEqualsAndHashcode">
- <description>
-Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
- </description>
- <priority>3</priority>
- <example>
- <![CDATA[
-public class Bar { // poor, missing a hashcode() method
- public boolean equals(Object o) {
- // do some comparison
- }
-}
-
-public class Baz { // poor, missing an equals() method
- public int hashCode() {
- // return some hash value
- }
-}
-
-public class Foo { // perfect, both methods provided
- public boolean equals(Object other) {
- // do some comparison
- }
- public int hashCode() {
- // return some hash value
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="DoubleCheckedLocking"
- language="java"
- since="1.04"
- message="Double checked locking is not thread safe in Java."
- class="net.sourceforge.pmd.lang.java.rule.basic.DoubleCheckedLockingRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}DoubleCheckedLocking">
- <description>
-Partially created objects can be returned by the Double Checked Locking pattern when used in Java.
-An optimizing JRE may assign a reference to the baz variable before it creates the object the
-reference is intended to point to.
-
-For more details refer to: http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html
- </description>
- <priority>1</priority>
- <example>
- <![CDATA[
-public class Foo {
- Object baz;
- Object bar() {
- if (baz == null) { // baz may be non-null yet not fully created
- synchronized(this) {
- if (baz == null) {
- baz = new Object();
- }
- }
- }
- return baz;
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="ReturnFromFinallyBlock"
- language="java"
- since="1.05"
- message="Avoid returning from a finally block"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ReturnFromFinallyBlock">
- <description>
-Avoid returning from a finally block, this can discard exceptions.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//FinallyStatement//ReturnStatement
-]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Bar {
- public String foo() {
- try {
- throw new Exception( "My Exception" );
- } catch (Exception e) {
- throw e;
- } finally {
- return "A. O. K."; // return not recommended here
- }
- }
-}
-]]>
- </example>
- </rule>
-
- <rule name="UnconditionalIfStatement"
- language="java"
- since="1.5"
- message="Do not use 'if' statements that are always true or always false"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}UnconditionalIfStatement">
- <description>
-Do not use "if" statements whose conditionals are always true or always false.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//IfStatement/Expression
- [count(PrimaryExpression)=1]
- /PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral
-]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Foo {
- public void close() {
- if (true) { // fixed conditional, not recommended
- // ...
- }
- }
-}
-]]>
- </example>
- </rule>
-
- <rule name="BooleanInstantiation"
- since="1.2"
- message="Avoid instantiating Boolean objects; reference Boolean.TRUE or Boolean.FALSE or call Boolean.valueOf() instead."
- class="net.sourceforge.pmd.lang.java.rule.basic.BooleanInstantiationRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}BooleanInstantiation">
- <description>
-Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boolean.valueOf() instead.
- </description>
- <priority>2</priority>
- <example>
- <![CDATA[
-Boolean bar = new Boolean("true"); // unnecessary creation, just reference Boolean.TRUE;
-Boolean buz = Boolean.valueOf(false); // ...., just reference Boolean.FALSE;
- ]]>
- </example>
- </rule>
-
- <rule name="CollapsibleIfStatements"
- language="java"
- since="3.1"
- message="These nested if statements could be combined"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}CollapsibleIfStatements">
- <description>
-Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//IfStatement[@Else='false']/Statement
- /IfStatement[@Else='false']
- |
-//IfStatement[@Else='false']/Statement
- /Block[count(BlockStatement)=1]/BlockStatement
- /Statement/IfStatement[@Else='false']]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-void bar() {
- if (x) { // original implementation
- if (y) {
- // do stuff
- }
- }
-}
-
-void bar() {
- if (x && y) { // optimized implementation
- // do stuff
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="ClassCastExceptionWithToArray"
- language="java"
- since="3.4"
- message="This usage of the Collection.toArray() method will throw a ClassCastException."
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ClassCastExceptionWithToArray">
- <description>
-When deriving an array of a specific class from your Collection, one should provide an array of
-the same class as the parameter of the toArray() method. Doing otherwise you will will result
-in a ClassCastException.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//CastExpression[Type/ReferenceType/ClassOrInterfaceType[@Image !=
-"Object"]]/PrimaryExpression
-[
- PrimaryPrefix/Name[ends-with(@Image, '.toArray')]
- and
- PrimarySuffix/Arguments[count(*) = 0]
-and
-count(PrimarySuffix) = 1
-]
-]]>
- </value>
- </property>
- </properties>
- <example>
-<![CDATA[
-Collection c = new ArrayList();
-Integer obj = new Integer(1);
-c.add(obj);
-
- // this would trigger the rule (and throw a ClassCastException if executed)
-Integer[] a = (Integer [])c.toArray();
-
- // this is fine and will not trigger the rule
-Integer[] b = (Integer [])c.toArray(new Integer[c.size()]);
-]]>
- </example>
-</rule>
-
-
-<rule name="AvoidDecimalLiteralsInBigDecimalConstructor"
- language="java"
- since="3.4"
- message="Avoid creating BigDecimal with a decimal (float/double) literal. Use a String literal"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidDecimalLiteralsInBigDecimalConstructor">
- <description>
-One might assume that the result of "new BigDecimal(0.1)" is exactly equal to 0.1, but it is actually
-equal to .1000000000000000055511151231257827021181583404541015625.
-This is because 0.1 cannot be represented exactly as a double (or as a binary fraction of any finite
-length). Thus, the long value that is being passed in to the constructor is not exactly equal to 0.1,
-appearances notwithstanding.
-
-The (String) constructor, on the other hand, is perfectly predictable: 'new BigDecimal("0.1")' is
-exactly equal to 0.1, as one would expect. Therefore, it is generally recommended that the
-(String) constructor be used in preference to this one.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//AllocationExpression[ClassOrInterfaceType[@Image="BigDecimal"]
-and
-./Arguments/ArgumentList
-/Expression/PrimaryExpression/PrimaryPrefix/Literal[(not
-(ends-with
-(@Image,'"'))) and contains(@Image,".")]]
- ]]>
- </value>
- </property>
- </properties>
- <example>
-<![CDATA[
-BigDecimal bd = new BigDecimal(1.123); // loss of precision, this would trigger the rule
-
-BigDecimal bd = new BigDecimal("1.123"); // preferred approach
-
-BigDecimal bd = new BigDecimal(12); // preferred approach, ok for integer values
-]]>
- </example>
-</rule>
-
-
- <rule name="MisplacedNullCheck"
- language="java"
- since="3.5"
- message="The null check here is misplaced; if the variable is null there'll be a NullPointerException"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}MisplacedNullCheck">
- <description>
-The null check here is misplaced. If the variable is null a NullPointerException will be thrown.
-Either the check is useless (the variable will never be "null") or it is incorrect.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//Expression
- /*[self::ConditionalOrExpression or self::ConditionalAndExpression]
- /descendant::PrimaryExpression/PrimaryPrefix
- /Name[starts-with(@Image,
- concat(ancestor::PrimaryExpression/following-sibling::EqualityExpression
- [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
- /PrimaryExpression/PrimaryPrefix
- /Name[count(../../PrimarySuffix)=0]/@Image,".")
- )
- ]
- [count(ancestor::ConditionalAndExpression/EqualityExpression
- [@Image='!=']
- [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
- [starts-with(following-sibling::*/PrimaryExpression/PrimaryPrefix/Name/@Image,
- concat(./PrimaryExpression/PrimaryPrefix/Name/@Image, '.'))]
- ) = 0
- ]
- ]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Foo {
- void bar() {
- if (a.equals(baz) && a != null) {}
- }
-}
- ]]>
- </example>
- <example><![CDATA[
-public class Foo {
- void bar() {
- if (a.equals(baz) || a == null) {}
- }
-}
- ]]></example>
- </rule>
-
-
- <rule name="AvoidThreadGroup"
- language="java"
- since="3.6"
- message="Avoid using java.lang.ThreadGroup; it is not thread safe"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidThreadGroup"
- typeResolution="true">
- <description>
-Avoid using java.lang.ThreadGroup; although it is intended to be used in a threaded environment
-it contains methods that are not thread-safe.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//AllocationExpression/ClassOrInterfaceType[pmd-java:typeof(@Image, 'java.lang.ThreadGroup')]|
-//PrimarySuffix[contains(@Image, 'getThreadGroup')]
-]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Bar {
- void buz() {
- ThreadGroup tg = new ThreadGroup("My threadgroup") ;
- tg = new ThreadGroup(tg, "my thread group");
- tg = Thread.currentThread().getThreadGroup();
- tg = System.getSecurityManager().getThreadGroup();
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="BrokenNullCheck"
- since="3.8"
- message="Method call on object which may be null"
- class="net.sourceforge.pmd.lang.java.rule.basic.BrokenNullCheckRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}BrokenNullCheck">
- <description>
-The null check is broken since it will throw a NullPointerException itself.
-It is likely that you used || instead of && or vice versa.
- </description>
- <priority>2</priority>
- <example>
-<![CDATA[
-public String bar(String string) {
- // should be &&
- if (string!=null || !string.equals(""))
- return string;
- // should be ||
- if (string==null && string.equals(""))
- return string;
-}
- ]]>
- </example>
- </rule>
-
- <rule name="BigIntegerInstantiation"
- since="3.9"
- message="Don't create instances of already existing BigInteger and BigDecimal (ZERO, ONE, TEN)"
- class="net.sourceforge.pmd.lang.java.rule.basic.BigIntegerInstantiationRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}BigIntegerInstantiation">
- <description>
-Don't create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) and
-for Java 1.5 onwards, BigInteger.TEN and BigDecimal (BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN)
- </description>
- <priority>3</priority>
- <example>
-<![CDATA[
-BigInteger bi = new BigInteger(1); // reference BigInteger.ONE instead
-BigInteger bi2 = new BigInteger("0"); // reference BigInteger.ZERO instead
-BigInteger bi3 = new BigInteger(0.0); // reference BigInteger.ZERO instead
-BigInteger bi4;
-bi4 = new BigInteger(0); // reference BigInteger.ZERO instead
-]]>
- </example>
-</rule>
-
- <rule name="AvoidUsingOctalValues"
- since="3.9"
- message="Do not start a literal by 0 unless it's an octal value"
- class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingOctalValuesRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidUsingOctalValues">
- <description>
- <![CDATA[
-Integer literals should not start with zero since this denotes that the rest of literal will be
-interpreted as an octal value.
- ]]>
- </description>
- <priority>3</priority>
- <example>
- <![CDATA[
-int i = 012; // set i with 10 not 12
-int j = 010; // set j with 8 not 10
-k = i * j; // set k with 80 not 120
- ]]>
- </example>
- </rule>
-
- <rule name="AvoidUsingHardCodedIP"
- since="4.1"
- message="Do not hard code the IP address ${symbol_dollar}{variableName}"
- class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingHardCodedIPRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidUsingHardCodedIP">
- <description>
- <![CDATA[
-Application with hard-coded IP addresses can become impossible to deploy in some cases.
-Externalizing IP adresses is preferable.
- ]]>
- </description>
- <priority>3</priority>
- <properties>
- <property name="pattern" type="String" description="Regular Expression" value='^"[0-9]{1,3}${symbol_escape}.[0-9]{1,3}${symbol_escape}.[0-9]{1,3}${symbol_escape}.[0-9]{1,3}"${symbol_dollar}'/>
- </properties>
- <example>
- <![CDATA[
-public class Foo {
- private String ip = "127.0.0.1"; // not recommended
-}
- ]]>
- </example>
- </rule>
-
- <!--
- not available in maven-pmd-plugin ???
- <rule name="CheckResultSet"
- language="java"
- since="4.1"
- class="net.sourceforge.pmd.lang.java.rule.basic.CheckResultSetRule"
- message="Always check the return of one of the navigation method (next,previous,first,last) of a ResultSet."
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}CheckResultSet">
- <description>
- <![CDATA[
-Always check the return values of navigation methods (next, previous, first, last) of a ResultSet.
-If the value return is 'false', it should be handled properly.
- ]]>
- </description>
- <priority>3</priority>
- <example>
- <![CDATA[
-Statement stat = conn.createStatement();
-ResultSet rst = stat.executeQuery("SELECT name FROM person");
-rst.next(); // what if it returns false? bad form
-String firstName = rst.getString(1);
-
-Statement stat = conn.createStatement();
-ResultSet rst = stat.executeQuery("SELECT name FROM person");
-if (rst.next()) { // result is properly examined and used
- String firstName = rst.getString(1);
- } else {
- // handle missing data
-}
- ]]>
- </example>
- </rule>
- -->
-
- <rule name="AvoidMultipleUnaryOperators"
- since="4.2"
- class="net.sourceforge.pmd.lang.java.rule.basic.AvoidMultipleUnaryOperatorsRule"
- message="Using multiple unary operators may be a bug, and/or is confusing."
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidMultipleUnaryOperators">
- <description>
- <![CDATA[
-The use of multiple unary operators may be problematic, and/or confusing.
-Ensure that the intended usage is not a bug, or consider simplifying the expression.
- ]]>
- </description>
- <priority>2</priority>
- <example>
- <![CDATA[
-// These are typo bugs, or at best needlessly complex and confusing:
-int i = - -1;
-int j = + - +1;
-int z = ~~2;
-boolean b = !!true;
-boolean c = !!!true;
-
-// These are better:
-int i = 1;
-int j = -1;
-int z = 2;
-boolean b = true;
-boolean c = false;
-
-// And these just make your brain hurt:
-int i = ~-2;
-int j = -~7;
- ]]>
- </example>
- </rule>
-
- <rule name="ExtendsObject"
- language="java"
- since="5.0"
- message="No need to explicitly extend Object."
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ExtendsObject">
- <description>No need to explicitly extend Object.</description>
- <priority>4</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//ExtendsList/ClassOrInterfaceType[@Image='Object' or @Image='java.lang.Object']
- ]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Foo extends Object { // not required
-}
- ]]>
- </example>
- </rule>
-
- <rule name="CheckSkipResult"
- language="java"
- since="5.0"
- message="Check the value returned by the skip() method of an InputStream to see if the requested number of bytes has been skipped."
- class="net.sourceforge.pmd.lang.java.rule.basic.CheckSkipResultRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}CheckSkipResult">
- <description>The skip() method may skip a smaller number of bytes than requested. Check the returned value to find out if it was the case or not.</description>
- <priority>3</priority>
- <example>
- <![CDATA[
-public class Foo {
-
- private FileInputStream _s = new FileInputStream("file");
-
- public void skip(int n) throws IOException {
- _s.skip(n); // You are not sure that exactly n bytes are skipped
- }
-
- public void skipExactly(int n) throws IOException {
- while (n != 0) {
- long skipped = _s.skip(n);
- if (skipped == 0)
- throw new EOFException();
- n -= skipped;
- }
- }
- ]]>
- </example>
- </rule>
-
- <rule name="AvoidBranchingStatementAsLastInLoop"
- since="5.0"
- class="net.sourceforge.pmd.lang.java.rule.basic.AvoidBranchingStatementAsLastInLoopRule"
- message="Avoid using a branching statement as the last in a loop."
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidBranchingStatementAsLastInLoop">
- <description>
- <![CDATA[
-Using a branching statement as the last part of a loop may be a bug, and/or is confusing.
-Ensure that the usage is not a bug, or consider using another approach.
- ]]>
- </description>
- <priority>2</priority>
- <example>
- <![CDATA[
- // unusual use of branching statement in a loop
-for (int i = 0; i < 10; i++) {
- if (i*i <= 25) {
- continue;
- }
- break;
-}
-
- // this makes more sense...
-for (int i = 0; i < 10; i++) {
- if (i*i > 25) {
- break;
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="DontCallThreadRun"
- language="java"
- since="4.3"
- message="Don't call Thread.run() explicitly, use Thread.start()"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}DontCallThreadRun">
- <description>
-Explicitly calling Thread.run() method will execute in the caller's thread of control. Instead, call Thread.start() for the intended behavior.
- </description>
- <priority>4</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//StatementExpression/PrimaryExpression
-[
- PrimaryPrefix
- [
- ./Name[ends-with(@Image, '.run') or @Image = 'run']
- and substring-before(Name/@Image, '.') =//VariableDeclarator/VariableDeclaratorId/@Image
- [../../../Type/ReferenceType[ClassOrInterfaceType/@Image = 'Thread']]
- or (
- ./AllocationExpression/ClassOrInterfaceType[@Image = 'Thread']
- and ../PrimarySuffix[@Image = 'run'])
- ]
-]
-]]>
- </value>
- </property>
- </properties>
- <example>
-<![CDATA[
-Thread t = new Thread();
-t.run(); // use t.start() instead
-new Thread().run(); // same violation
-]]>
- </example>
- </rule>
-
- <rule name="DontUseFloatTypeForLoopIndices"
- language="java"
- since="4.3"
- message="Don't use floating point for loop indices. If you must use floating point, use double."
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}DontUseFloatTypeForLoopIndices">
- <description>
-Don't use floating point for loop indices. If you must use floating point, use double
-unless you're certain that float provides enough precision and you have a compelling
-performance need (space or time).
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//ForStatement/ForInit/LocalVariableDeclaration
-/Type/PrimitiveType[@Image="float"]
-]]>
- </value>
- </property>
- </properties>
- <example>
-<![CDATA[
-public class Count {
- public static void main(String[] args) {
- final int START = 2000000000;
- int count = 0;
- for (float f = START; f < START + 50; f++)
- count++;
- //Prints 0 because (float) START == (float) (START + 50).
- System.out.println(count);
- //The termination test misbehaves due to floating point granularity.
- }
-}
-]]>
- </example>
- </rule>
-
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyCatchBlock" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyIfStmt" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyWhileStmt" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyTryBlock" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyFinallyBlock" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySwitchStatements" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySynchronizedBlock" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementNotInLoop" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyInitializer" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementBlock" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStaticInitializer" />
-
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryConversionTemporary" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryReturn" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryFinalModifier" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOverridingMethod" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOperationOnImmutable" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnusedNullCheckInEquals" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessParentheses" />
-
-</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/imports.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/imports.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/imports.xml
deleted file mode 100644
index 28fc2a2..0000000
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/imports.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-<?xml version="1.0"?>
-
-<ruleset name="Import Statements"
- xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
-
- <description>
-These rules deal with different problems that can occur with import statements.
- </description>
-
- <rule name="DuplicateImports"
- since="0.5"
- message="Avoid duplicate imports such as ''{0}''"
- class="net.sourceforge.pmd.lang.java.rule.imports.DuplicateImportsRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}DuplicateImports">
- <description>
-Duplicate or overlapping import statements should be avoided.
- </description>
- <priority>4</priority>
- <example>
-<![CDATA[
-import java.lang.String;
-import java.lang.*;
-public class Foo {}
-]]>
- </example>
- </rule>
-
- <rule name="DontImportJavaLang"
- since="0.5"
- message="Avoid importing anything from the package 'java.lang'"
- class="net.sourceforge.pmd.lang.java.rule.imports.DontImportJavaLangRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}DontImportJavaLang">
- <description>
-Avoid importing anything from the package 'java.lang'. These classes are automatically imported (JLS 7.5.3).
- </description>
- <priority>4</priority>
- <example>
-<![CDATA[
-import java.lang.String; // this is unnecessary
-
-public class Foo {}
-
-// --- in another source code file...
-
-import java.lang.*; // this is bad
-
-public class Foo {}
-]]>
- </example>
- </rule>
-
- <rule name="UnusedImports"
- since="1.0"
- message="Avoid unused imports such as ''{0}''"
- class="net.sourceforge.pmd.lang.java.rule.imports.UnusedImportsRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}UnusedImports">
- <description>
-Avoid the use of unused import statements to prevent unwanted dependencies.
- </description>
- <priority>4</priority>
- <example>
-<![CDATA[
-// this is bad
-import java.io.File;
-public class Foo {}
-]]>
- </example>
- </rule>
-
- <rule name="ImportFromSamePackage"
- since="1.02"
- message="No need to import a type that lives in the same package"
- class="net.sourceforge.pmd.lang.java.rule.imports.ImportFromSamePackageRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}ImportFromSamePackage">
- <description>
-There is no need to import a type that lives in the same package.
- </description>
- <priority>3</priority>
- <example>
- <![CDATA[
- package foo;
-
- import foo.Buz; // no need for this
- import foo.*; // or this
-
- public class Bar{}
- ]]>
- </example>
- </rule>
-
- <rule name="TooManyStaticImports"
- language="java"
- since="4.1"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- message="Too many static imports may lead to messy code"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}TooManyStaticImports">
- <description><![CDATA[
-If you overuse the static import feature, it can make your program unreadable and
-unmaintainable, polluting its namespace with all the static members you import.
-Readers of your code (including you, a few months after you wrote it) will not know
-which class a static member comes from (Sun 1.5 Language Guide).
- ]]></description>
- <priority>3</priority>
- <properties>
- <property name="maximumStaticImports" type="Integer"
- description="All static imports can be disallowed by setting this to 0" min="0" max="100" value="4"/>
- <property name="xpath">
- <value><![CDATA[
-.[count(ImportDeclaration[@Static = 'true']) > ${symbol_dollar}maximumStaticImports]
- ]]></value>
- </property>
- </properties>
- <example><![CDATA[
-import static Lennon;
-import static Ringo;
-import static George;
-import static Paul;
-import static Yoko; // Too much !
- ]]></example>
- </rule>
-
- <rule name="UnnecessaryFullyQualifiedName"
- language="java"
- since="5.0"
- class="net.sourceforge.pmd.lang.java.rule.imports.UnnecessaryFullyQualifiedNameRule"
- message="Unnecessary use of fully qualified name ''{0}'' due to existing import ''{1}''"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}UnnecessaryFullyQualifiedName">
- <description><![CDATA[
-Import statements allow the use of non-fully qualified names. The use of a fully qualified name
-which is covered by an import statement is redundant. Consider using the non-fully qualified name.
- ]]></description>
- <priority>4</priority>
- <example><![CDATA[
-import java.util.List;
-
-public class Foo {
- private java.util.List list1; // Unnecessary FQN
- private List list2; // More appropriate given import of 'java.util.List'
-}
- ]]></example>
- </rule>
-
-</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/rulesets.properties
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/rulesets.properties b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/rulesets.properties
deleted file mode 100644
index 0a1c2d3..0000000
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/rulesets.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-rulesets.filenames=rulesets/java/basic.xml,rulesets/java/imports.xml,rulesets/java/unusedcode.xml
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/unusedcode.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/unusedcode.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/unusedcode.xml
deleted file mode 100644
index 6e3d178..0000000
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd-rulesets/unusedcode.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-<?xml version="1.0"?>
-
-<ruleset name="Unused Code"
- xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
- <description>
-The Unused Code ruleset contains rules that find unused or ineffective code.
- </description>
-
- <rule name="UnusedPrivateField"
- since="0.1"
- language="java"
- message="Avoid unused private fields such as ''{0}''."
- class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateFieldRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedPrivateField">
- <description>
-Detects when a private field is declared and/or assigned a value, but not used.
- </description>
- <priority>3</priority>
- <example>
-<![CDATA[
-public class Something {
- private static int FOO = 2; // Unused
- private int i = 5; // Unused
- private int j = 6;
- public int addOne() {
- return j++;
- }
-}
-]]>
- </example>
- </rule>
-
- <rule name="UnusedLocalVariable"
- language="java"
- since="0.1"
- message="Avoid unused local variables such as ''{0}''."
- class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedLocalVariableRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedLocalVariable">
- <description>
-Detects when a local variable is declared and/or assigned, but not used.
- </description>
- <priority>3</priority>
-
- <example>
-<![CDATA[
-public class Foo {
- public void doSomething() {
- int i = 5; // Unused
- }
-}
-]]>
- </example>
- </rule>
-
- <rule name="UnusedPrivateMethod"
- language="java"
- since="0.7"
- message="Avoid unused private methods such as ''{0}''."
- class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateMethodRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedPrivateMethod">
- <description>
-Unused Private Method detects when a private method is declared but is unused.
- </description>
- <priority>3</priority>
- <example>
-<![CDATA[
-public class Something {
- private void foo() {} // unused
-}
-]]>
- </example>
- </rule>
-
-
- <rule name="UnusedFormalParameter"
- language="java"
- since="0.8"
- message="Avoid unused {0} parameters such as ''{1}''."
- class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedFormalParameterRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedFormalParameter">
- <description>
-Avoid passing parameters to methods or constructors without actually referencing them in the method body.
- </description>
- <priority>3</priority>
-
- <example>
-<![CDATA[
-public class Foo {
- private void bar(String howdy) {
- // howdy is not used
- }
-}
-]]>
- </example>
- </rule>
-
- <rule name="UnusedModifier"
- language="java"
- since="1.02"
- message="Avoid modifiers which are implied by the context"
- class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedModifierRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedModifier">
- <description>
-Fields in interfaces are automatically public static final, and methods are public abstract.
-Classes or interfaces nested in an interface are automatically public and static (all nested interfaces are automatically static).
-For historical reasons, modifiers which are implied by the context are accepted by the compiler, but are superfluous.
- </description>
- <priority>3</priority>
- <example>
- <![CDATA[
-public interface Foo {
- public abstract void bar(); // both abstract and public are ignored by the compiler
- public static final int X = 0; // public, static, and final all ignored
- public static class Bar {} // public, static ignored
- public static interface Baz {} // ditto
-}
-public class Bar {
- public static interface Baz {} // static ignored
-}
- ]]>
- </example>
- </rule>
- </ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd.xml
deleted file mode 100644
index ac23283..0000000
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/pmd.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<ruleset name="Maven Ruleset"
- xmlns="http://pmd.sf.net/ruleset/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
- xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
-
- <!--
- Customized PMD ruleset for Maven, see [0] for more information
- [0] http://pmd.sourceforge.net/howtomakearuleset.html
- -->
-
- <description>
- This ruleset checks the code for discouraged programming constructs.
- </description>
-
- <rule ref="pmd-rulesets/basic.xml">
- <exclude name="EmptyCatchBlock"/>
- </rule>
- <rule ref="pmd-rulesets/basic.xml/EmptyCatchBlock">
- <properties>
- <property name="allowCommentedBlocks" value="true"/>
- </properties>
- </rule>
-
- <rule ref="pmd-rulesets/unusedcode.xml"/>
- <rule ref="pmd-rulesets/imports.xml"/>
-</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties b/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
index 0055a6f..855a886 100644
--- a/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
+++ b/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
@@ -1,4 +1,4 @@
-#Thu Nov 24 11:25:49 GMT 2016
+#Thu Nov 24 11:38:07 GMT 2016
package=it.pkg
version=0.1-SNAPSHOT
groupId=archetype.it
[11/11] isis git commit: ISIS-1538: recreating simpleapp archetype
Posted by da...@apache.org.
ISIS-1538: recreating simpleapp archetype
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/f63e38ae
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/f63e38ae
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/f63e38ae
Branch: refs/heads/maint-1.13.2
Commit: f63e38ae6306fbe191a7a76ccbb72114627b2ca5
Parents: 83eb176
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Nov 24 16:04:34 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 24 16:04:34 2016 +0000
----------------------------------------------------------------------
.../archetype-resources/application/pom.xml | 4 ++
.../application/translations.pot | 2 +-
.../modules/module-simple/translations.pot | 2 +-
.../main/resources/archetype-resources/pom.xml | 39 +++++++++++++++-----
.../archetype-resources/webapp/pom.xml | 16 ++++++++
.../projects/basic/archetype.properties | 2 +-
6 files changed, 52 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/f63e38ae/example/archetype/simpleapp/src/main/resources/archetype-resources/application/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/pom.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/pom.xml
index b1542bb..ae0cbee 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/pom.xml
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/pom.xml
@@ -96,11 +96,15 @@
</build>
<dependencies>
+
+ <!-- this app -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${rootArtifactId}-module-simple</artifactId>
</dependency>
+
+ <!-- isis -->
<dependency>
<groupId>org.apache.isis.core</groupId>
<artifactId>isis-core-wrapper</artifactId>
http://git-wip-us.apache.org/repos/asf/isis/blob/f63e38ae/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
index 24fc42d..381e4ba 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
@@ -23,7 +23,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
-"POT-Creation-Date: 2016-11-24 11:36:31+\n"
+"POT-Creation-Date: 2016-11-24 14:44:27+\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
http://git-wip-us.apache.org/repos/asf/isis/blob/f63e38ae/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
index c96f2e8..aadc192 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
@@ -23,7 +23,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
-"POT-Creation-Date: 2016-11-24 11:36:24+\n"
+"POT-Creation-Date: 2016-11-24 14:44:20+\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
http://git-wip-us.apache.org/repos/asf/isis/blob/f63e38ae/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
index c4cabe1..0cf1d7c 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/pom.xml
@@ -35,7 +35,7 @@
<isis.version>1.14.0-SNAPSHOT</isis.version>
<lombok.version>1.16.10</lombok.version>
- <assertj-core.version>2.4.0</assertj-core.version>
+ <assertj-core.version>3.6.0</assertj-core.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@@ -55,14 +55,38 @@
<repository>
<id>Cloudbees snapshots</id>
<url>http://repository-estatio.forge.cloudbees.com/snapshot/</url>
- <snapshots>
- </snapshots>
+ <name>CloudBees Snapshots (and Interim Releases)</name>
<releases>
- <enabled>false</enabled>
+ <updatePolicy>never</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
</releases>
+ <snapshots>
+ <updatePolicy>never</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </snapshots>
+ <layout>default</layout>
+ </repository>
+ <repository>
+ <id>sonatype-snapshots</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ <snapshots>
+ </snapshots>
</repository>
</repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>estatio.snapshots</id>
+ <name>CloudBees Snapshots (and Interim Releases)</name>
+ <releases>
+ <updatePolicy>never</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </releases>
+ <url>http://repository-estatio.forge.cloudbees.com/snapshot/</url>
+ <layout>default</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
<dependencyManagement>
<dependencies>
@@ -74,12 +98,6 @@
<scope>import</scope>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj-core.version}</version>
- </dependency>
-
<!-- this project's own modules -->
<dependency>
<groupId>${project.groupId}</groupId>
@@ -97,6 +115,7 @@
<version>${version}</version>
</dependency>
+ <!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
http://git-wip-us.apache.org/repos/asf/isis/blob/f63e38ae/example/archetype/simpleapp/src/main/resources/archetype-resources/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/webapp/pom.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/webapp/pom.xml
index b0719b5..a52e795 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/webapp/pom.xml
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/webapp/pom.xml
@@ -59,6 +59,19 @@
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <version>1.4</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
@@ -109,11 +122,14 @@
</build>
<dependencies>
+
+ <!-- this app -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${rootArtifactId}-application</artifactId>
</dependency>
+ <!-- isis -->
<dependency>
<groupId>com.danhaywood.mavendeps</groupId>
<artifactId>isiswebapp</artifactId>
http://git-wip-us.apache.org/repos/asf/isis/blob/f63e38ae/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties b/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
index 855a886..fa74ed8 100644
--- a/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
+++ b/example/archetype/simpleapp/src/test/resources/projects/basic/archetype.properties
@@ -1,4 +1,4 @@
-#Thu Nov 24 11:38:07 GMT 2016
+#Thu Nov 24 16:04:30 GMT 2016
package=it.pkg
version=0.1-SNAPSHOT
groupId=archetype.it
[09/11] isis git commit: ISIS-1538: recreating simpleapp archetype
Posted by da...@apache.org.
ISIS-1538: recreating simpleapp archetype
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/6f428cee
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/6f428cee
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/6f428cee
Branch: refs/heads/maint-1.13.2
Commit: 6f428ceec0b93ffb4e47facabdc757b9f846339a
Parents: f921dc5
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Nov 24 11:38:12 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 24 11:38:12 2016 +0000
----------------------------------------------------------------------
.../META-INF/maven/archetype-metadata.xml | 8 +-
.../application/translations.pot | 8 +-
.../modules/checks/checkstyle.xml | 290 +++++++
.../modules/checks/pmd-rulesets/basic.xml | 810 +++++++++++++++++++
.../modules/checks/pmd-rulesets/imports.xml | 148 ++++
.../checks/pmd-rulesets/rulesets.properties | 4 +
.../modules/checks/pmd-rulesets/unusedcode.xml | 128 +++
.../archetype-resources/modules/checks/pmd.xml | 49 ++
.../archetype-resources/modules/checkstyle.xml | 290 -------
.../modules/module-simple/pom.xml | 4 +-
.../modules/module-simple/translations.pot | 2 +-
.../modules/pmd-rulesets/basic.xml | 810 -------------------
.../modules/pmd-rulesets/imports.xml | 148 ----
.../modules/pmd-rulesets/rulesets.properties | 4 -
.../modules/pmd-rulesets/unusedcode.xml | 128 ---
.../archetype-resources/modules/pmd.xml | 49 --
.../projects/basic/archetype.properties | 2 +-
17 files changed, 1441 insertions(+), 1441 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml b/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
index e8e4a02..9fa5ed6 100644
--- a/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/example/archetype/simpleapp/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -20,19 +20,13 @@
<archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" name="simpleapp" xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
- <directory>modules/pmd-rulesets</directory>
+ <directory>modules/checks</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
- <directory>modules</directory>
- <includes>
- <include>**/*.xml</include>
- </includes>
- </fileSet>
- <fileSet filtered="true" encoding="UTF-8">
<directory/>
<includes>
<include>pom-jdo-enhance-all.xml</include>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
index 96693a1..24fc42d 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/application/translations.pot
@@ -23,7 +23,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
-"POT-Creation-Date: 2016-11-24 10:28:29+\n"
+"POT-Creation-Date: 2016-11-24 11:36:31+\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -155,6 +155,11 @@ msgid "Friendly Name"
msgstr ""
+#: domainapp.application.services.dbmanager.HsqlDbManagerMenu#hsqlDbManager()
+msgid "HSQL DB Manager"
+msgstr ""
+
+
#: domainapp.application.services.homepage.HomePageService#homePage()
msgid "Home Page"
msgstr ""
@@ -291,6 +296,7 @@ msgid "Property"
msgstr ""
+#: domainapp.application.services.dbmanager.HsqlDbManagerMenu
#: org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault
#: org.apache.isis.applib.services.layout.LayoutServiceMenu
#: org.apache.isis.applib.services.metamodel.MetaModelServicesMenu
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/checkstyle.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/checkstyle.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/checkstyle.xml
new file mode 100644
index 0000000..1d57a99
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/checkstyle.xml
@@ -0,0 +1,290 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
+
+<!--
+
+ Checkstyle configuration that checks the sun coding conventions from:
+
+ - the Java Language Specification at
+ http://java.sun.com/docs/books/jls/second_edition/html/index.html
+
+ - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+
+ - the Javadoc guidelines at
+ http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+
+ - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+
+ - some best practices
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.sf.net (or in your downloaded distribution).
+
+ Most Checks are configurable, be sure to consult the documentation.
+
+ To completely disable a check, just comment it out or delete it from the file.
+
+ Finally, it is worth reading the documentation.
+
+-->
+
+<module name="Checker">
+
+ <!-- Checks that a package.html file exists for each package. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html${symbol_pound}PackageHtml -->
+ <module name="JavadocPackage"/>
+ <!--
+ -->
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html${symbol_pound}NewlineAtEndOfFile -->
+ <!--
+ <module name="NewlineAtEndOfFile"/>
+ -->
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html${symbol_pound}Translation -->
+ <module name="Translation"/>
+
+ <!--
+ eg:
+ //CHECKSTYLE.OFF: IllegalCatch - Much more readable than catching 7 exceptions
+ catch (Exception e)
+ //CHECKSTYLE.ON: IllegalCatch
+ -->
+ <module name="SuppressionCommentFilter">
+ <property name="offCommentFormat" value="CHECKSTYLE.OFF${symbol_escape}: ([${symbol_escape}w${symbol_escape}|]+)"/>
+ <property name="onCommentFormat" value="CHECKSTYLE.ON${symbol_escape}: ([${symbol_escape}w${symbol_escape}|]+)"/>
+ <property name="checkFormat" value="${symbol_dollar}1"/>
+ </module>
+
+ <!--
+ eg:
+ // CHECKSTYLE IGNORE check FOR NEXT 1 LINES
+ public void onClick(View view) { ... } -->
+ <module name="SuppressWithNearbyCommentFilter">
+ <property name="commentFormat" value="CHECKSTYLE.IGNORE (${symbol_escape}w+) FOR NEXT (${symbol_escape}d+) LINES"/>
+ <property name="checkFormat" value="${symbol_dollar}1"/>
+ <property name="influenceFormat" value="${symbol_dollar}2"/>
+ </module>
+
+ <module name="TreeWalker">
+
+ <property name="cacheFile" value="${symbol_dollar}{checkstyle.cache.file}"/>
+
+ <!-- not available in eclipse-cs
+ <module name="JavadocDeprecated"/>
+ -->
+ <module name="MissingOverride"/>
+
+ <!-- ************************************************************** -->
+ <!-- Checks that are different from the sun coding conventions ones -->
+ <!-- ************************************************************** -->
+ <property name="tabWidth" value="4"/>
+ <module name="LeftCurly">
+ <property name="option" value="eol"/>
+ </module>
+ <module name="RightCurly">
+ <property name="option" value="same"/>
+ </module>
+ <module name="MemberName">
+ <property name="format" value="^[a-z]([a-zA-Z0-9])*${symbol_dollar}"/>
+ </module>
+ <module name="StaticVariableName">
+ <property name="format" value="^[A-Z](_?[A-Z0-9])*${symbol_dollar}"/>
+ </module>
+ <module name="MethodName">
+ <property name="format" value="[a-z](_?[a-zA-Z0-9]+)*${symbol_dollar}"/>
+ </module>
+ <module name="ParameterName">
+ <property name="format" value="[a-z]([a-zA-Z0-9]+)*${symbol_dollar}"/>
+ </module>
+ <module name="LocalVariableName">
+ <property name="format" value="[a-z]([a-zA-Z0-9]+)*${symbol_dollar}"/>
+ </module>
+
+ <!-- ************************************************************** -->
+ <!-- Default Sun coding conventions checks -->
+ <!-- ************************************************************** -->
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+
+ <!-- TODO: instate at some point (though only for public methods
+ <module name="JavadocType"/>
+ -->
+ <!--
+ <module name="JavadocMethod"/>
+ <module name="JavadocVariable"/>
+ -->
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName"/>
+ <module name="PackageName"/>
+ <module name="TypeName"/>
+ <module name="LocalFinalVariableName"/>
+
+
+ <!-- Checks for Headers -->
+ <!-- See http://checkstyle.sf.net/config_header.html -->
+ <!--
+ <module name="Header">
+ -->
+ <!-- The follow property value demonstrates the ability -->
+ <!-- to have access to ANT properties. In this case it uses -->
+ <!-- the ${symbol_dollar}{basedir} property to allow Checkstyle to be run -->
+ <!-- from any directory within a project. -->
+ <!--
+ <property name="headerFile" value="${symbol_dollar}{checkstyle.header.file}"/>
+ </module>
+ -->
+
+ <!-- Following interprets the header file as regular expressions. -->
+ <!-- <module name="RegexpHeader"/> -->
+
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport"/>
+ <module name="IllegalImport"/>
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="EmptyBlock"/>
+ <module name="NeedBraces"/>
+ <!--
+ <module name="AvoidNestedBlocks"/>
+ -->
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <module name="EmptyStatement"/>
+ <module name="MagicNumber"/>
+ <module name="MissingSwitchDefault"/>
+ <module name="RedundantThrows"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+
+ <!-- not supported in maven
+ <module name="DoubleCheckedLocking"/>
+ -->
+ <!--
+ <module name="AvoidInlineConditionals"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField"/>
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+ -->
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!--
+
+ <module name="VisibilityModifier"/>
+ -->
+ <!-- too many violations...
+ <module name="DesignForExtension"/>
+ -->
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ <module name="InterfaceIsType"/>
+
+
+ <module name="CyclomaticComplexity">
+ <property name="max" value="12"/>
+ </module>
+ <module name="NPathComplexity">
+ <property name="max" value="160"/>
+ </module>
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <!--
+ <module name="ArrayTypeStyle"/>
+ <module name="GenericIllegalRegexp">
+ <property name="format" value="${symbol_escape}s+${symbol_dollar}"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+ -->
+ <!-- removed; we detect these in other ways.
+ <module name="TodoComment"/>
+ -->
+ <module name="UpperEll"/>
+ <module name="FinalParameters"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <!--
+ <module name="NoWhitespaceAfter"/>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+ <module name="TabCharacter"/>
+ -->
+ <module name="EmptyForIteratorPad"/>
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <!--
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+ -->
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="LineLength">
+ <property name="max" value="120"/>
+ </module>
+ <module name="MethodLength">
+ <property name="max" value="30"/>
+ </module>
+ <module name="ParameterNumber">
+ <property name="max" value="6"/>
+ </module>
+
+ </module>
+
+
+
+ <module name="FileLength">
+ <property name="max" value="1500"/>
+ </module>
+
+ <module name="FileTabCharacter">
+ <property name="eachLine" value="true"/>
+ <property name="fileExtensions" value="java,xml"/>
+ </module>
+
+</module>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/basic.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/basic.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/basic.xml
new file mode 100644
index 0000000..4ee44b0
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/basic.xml
@@ -0,0 +1,810 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0"?>
+
+<ruleset name="Basic"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+ <description>
+The Basic ruleset contains a collection of good practices which should be followed.
+ </description>
+
+ <rule name="JumbledIncrementer"
+ language="java"
+ since="1.0"
+ message="Avoid modifying an outer loop incrementer in an inner loop for update expression"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}JumbledIncrementer">
+ <description>
+Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ForStatement
+ [
+ ForUpdate/StatementExpressionList/StatementExpression/PostfixExpression/PrimaryExpression/PrimaryPrefix/Name/@Image
+ =
+ ancestor::ForStatement/ForInit//VariableDeclaratorId/@Image
+ ]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class JumbledIncrementerRule1 {
+ public void foo() {
+ for (int i = 0; i < 10; i++) { // only references 'i'
+ for (int k = 0; k < 20; i++) { // references both 'i' and 'k'
+ System.out.println("Hello");
+ }
+ }
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ForLoopShouldBeWhileLoop"
+ language="java"
+ since="1.02"
+ message="This for loop could be simplified to a while loop"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ForLoopShouldBeWhileLoop">
+ <description>
+Some for loops can be simplified to while loops, this makes them more concise.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ForStatement
+ [count(*) > 1]
+ [not(LocalVariableDeclaration)]
+ [not(ForInit)]
+ [not(ForUpdate)]
+ [not(Type and Expression and Statement)]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ void bar() {
+ for (;true;) true; // No Init or Update part, may as well be: while (true)
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="OverrideBothEqualsAndHashcode"
+ language="java"
+ since="0.4"
+ message="Ensure you override both equals() and hashCode()"
+ class="net.sourceforge.pmd.lang.java.rule.basic.OverrideBothEqualsAndHashcodeRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}OverrideBothEqualsAndHashcode">
+ <description>
+Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public class Bar { // poor, missing a hashcode() method
+ public boolean equals(Object o) {
+ // do some comparison
+ }
+}
+
+public class Baz { // poor, missing an equals() method
+ public int hashCode() {
+ // return some hash value
+ }
+}
+
+public class Foo { // perfect, both methods provided
+ public boolean equals(Object other) {
+ // do some comparison
+ }
+ public int hashCode() {
+ // return some hash value
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="DoubleCheckedLocking"
+ language="java"
+ since="1.04"
+ message="Double checked locking is not thread safe in Java."
+ class="net.sourceforge.pmd.lang.java.rule.basic.DoubleCheckedLockingRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}DoubleCheckedLocking">
+ <description>
+Partially created objects can be returned by the Double Checked Locking pattern when used in Java.
+An optimizing JRE may assign a reference to the baz variable before it creates the object the
+reference is intended to point to.
+
+For more details refer to: http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html
+ </description>
+ <priority>1</priority>
+ <example>
+ <![CDATA[
+public class Foo {
+ Object baz;
+ Object bar() {
+ if (baz == null) { // baz may be non-null yet not fully created
+ synchronized(this) {
+ if (baz == null) {
+ baz = new Object();
+ }
+ }
+ }
+ return baz;
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ReturnFromFinallyBlock"
+ language="java"
+ since="1.05"
+ message="Avoid returning from a finally block"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ReturnFromFinallyBlock">
+ <description>
+Avoid returning from a finally block, this can discard exceptions.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//FinallyStatement//ReturnStatement
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Bar {
+ public String foo() {
+ try {
+ throw new Exception( "My Exception" );
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ return "A. O. K."; // return not recommended here
+ }
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnconditionalIfStatement"
+ language="java"
+ since="1.5"
+ message="Do not use 'if' statements that are always true or always false"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}UnconditionalIfStatement">
+ <description>
+Do not use "if" statements whose conditionals are always true or always false.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//IfStatement/Expression
+ [count(PrimaryExpression)=1]
+ /PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ public void close() {
+ if (true) { // fixed conditional, not recommended
+ // ...
+ }
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="BooleanInstantiation"
+ since="1.2"
+ message="Avoid instantiating Boolean objects; reference Boolean.TRUE or Boolean.FALSE or call Boolean.valueOf() instead."
+ class="net.sourceforge.pmd.lang.java.rule.basic.BooleanInstantiationRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}BooleanInstantiation">
+ <description>
+Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boolean.valueOf() instead.
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+Boolean bar = new Boolean("true"); // unnecessary creation, just reference Boolean.TRUE;
+Boolean buz = Boolean.valueOf(false); // ...., just reference Boolean.FALSE;
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="CollapsibleIfStatements"
+ language="java"
+ since="3.1"
+ message="These nested if statements could be combined"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}CollapsibleIfStatements">
+ <description>
+Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//IfStatement[@Else='false']/Statement
+ /IfStatement[@Else='false']
+ |
+//IfStatement[@Else='false']/Statement
+ /Block[count(BlockStatement)=1]/BlockStatement
+ /Statement/IfStatement[@Else='false']]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+void bar() {
+ if (x) { // original implementation
+ if (y) {
+ // do stuff
+ }
+ }
+}
+
+void bar() {
+ if (x && y) { // optimized implementation
+ // do stuff
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ClassCastExceptionWithToArray"
+ language="java"
+ since="3.4"
+ message="This usage of the Collection.toArray() method will throw a ClassCastException."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ClassCastExceptionWithToArray">
+ <description>
+When deriving an array of a specific class from your Collection, one should provide an array of
+the same class as the parameter of the toArray() method. Doing otherwise you will will result
+in a ClassCastException.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//CastExpression[Type/ReferenceType/ClassOrInterfaceType[@Image !=
+"Object"]]/PrimaryExpression
+[
+ PrimaryPrefix/Name[ends-with(@Image, '.toArray')]
+ and
+ PrimarySuffix/Arguments[count(*) = 0]
+and
+count(PrimarySuffix) = 1
+]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+Collection c = new ArrayList();
+Integer obj = new Integer(1);
+c.add(obj);
+
+ // this would trigger the rule (and throw a ClassCastException if executed)
+Integer[] a = (Integer [])c.toArray();
+
+ // this is fine and will not trigger the rule
+Integer[] b = (Integer [])c.toArray(new Integer[c.size()]);
+]]>
+ </example>
+</rule>
+
+
+<rule name="AvoidDecimalLiteralsInBigDecimalConstructor"
+ language="java"
+ since="3.4"
+ message="Avoid creating BigDecimal with a decimal (float/double) literal. Use a String literal"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidDecimalLiteralsInBigDecimalConstructor">
+ <description>
+One might assume that the result of "new BigDecimal(0.1)" is exactly equal to 0.1, but it is actually
+equal to .1000000000000000055511151231257827021181583404541015625.
+This is because 0.1 cannot be represented exactly as a double (or as a binary fraction of any finite
+length). Thus, the long value that is being passed in to the constructor is not exactly equal to 0.1,
+appearances notwithstanding.
+
+The (String) constructor, on the other hand, is perfectly predictable: 'new BigDecimal("0.1")' is
+exactly equal to 0.1, as one would expect. Therefore, it is generally recommended that the
+(String) constructor be used in preference to this one.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//AllocationExpression[ClassOrInterfaceType[@Image="BigDecimal"]
+and
+./Arguments/ArgumentList
+/Expression/PrimaryExpression/PrimaryPrefix/Literal[(not
+(ends-with
+(@Image,'"'))) and contains(@Image,".")]]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+BigDecimal bd = new BigDecimal(1.123); // loss of precision, this would trigger the rule
+
+BigDecimal bd = new BigDecimal("1.123"); // preferred approach
+
+BigDecimal bd = new BigDecimal(12); // preferred approach, ok for integer values
+]]>
+ </example>
+</rule>
+
+
+ <rule name="MisplacedNullCheck"
+ language="java"
+ since="3.5"
+ message="The null check here is misplaced; if the variable is null there'll be a NullPointerException"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}MisplacedNullCheck">
+ <description>
+The null check here is misplaced. If the variable is null a NullPointerException will be thrown.
+Either the check is useless (the variable will never be "null") or it is incorrect.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//Expression
+ /*[self::ConditionalOrExpression or self::ConditionalAndExpression]
+ /descendant::PrimaryExpression/PrimaryPrefix
+ /Name[starts-with(@Image,
+ concat(ancestor::PrimaryExpression/following-sibling::EqualityExpression
+ [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
+ /PrimaryExpression/PrimaryPrefix
+ /Name[count(../../PrimarySuffix)=0]/@Image,".")
+ )
+ ]
+ [count(ancestor::ConditionalAndExpression/EqualityExpression
+ [@Image='!=']
+ [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
+ [starts-with(following-sibling::*/PrimaryExpression/PrimaryPrefix/Name/@Image,
+ concat(./PrimaryExpression/PrimaryPrefix/Name/@Image, '.'))]
+ ) = 0
+ ]
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ void bar() {
+ if (a.equals(baz) && a != null) {}
+ }
+}
+ ]]>
+ </example>
+ <example><![CDATA[
+public class Foo {
+ void bar() {
+ if (a.equals(baz) || a == null) {}
+ }
+}
+ ]]></example>
+ </rule>
+
+
+ <rule name="AvoidThreadGroup"
+ language="java"
+ since="3.6"
+ message="Avoid using java.lang.ThreadGroup; it is not thread safe"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidThreadGroup"
+ typeResolution="true">
+ <description>
+Avoid using java.lang.ThreadGroup; although it is intended to be used in a threaded environment
+it contains methods that are not thread-safe.
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//AllocationExpression/ClassOrInterfaceType[pmd-java:typeof(@Image, 'java.lang.ThreadGroup')]|
+//PrimarySuffix[contains(@Image, 'getThreadGroup')]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Bar {
+ void buz() {
+ ThreadGroup tg = new ThreadGroup("My threadgroup") ;
+ tg = new ThreadGroup(tg, "my thread group");
+ tg = Thread.currentThread().getThreadGroup();
+ tg = System.getSecurityManager().getThreadGroup();
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="BrokenNullCheck"
+ since="3.8"
+ message="Method call on object which may be null"
+ class="net.sourceforge.pmd.lang.java.rule.basic.BrokenNullCheckRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}BrokenNullCheck">
+ <description>
+The null check is broken since it will throw a NullPointerException itself.
+It is likely that you used || instead of && or vice versa.
+ </description>
+ <priority>2</priority>
+ <example>
+<![CDATA[
+public String bar(String string) {
+ // should be &&
+ if (string!=null || !string.equals(""))
+ return string;
+ // should be ||
+ if (string==null && string.equals(""))
+ return string;
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="BigIntegerInstantiation"
+ since="3.9"
+ message="Don't create instances of already existing BigInteger and BigDecimal (ZERO, ONE, TEN)"
+ class="net.sourceforge.pmd.lang.java.rule.basic.BigIntegerInstantiationRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}BigIntegerInstantiation">
+ <description>
+Don't create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) and
+for Java 1.5 onwards, BigInteger.TEN and BigDecimal (BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN)
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+BigInteger bi = new BigInteger(1); // reference BigInteger.ONE instead
+BigInteger bi2 = new BigInteger("0"); // reference BigInteger.ZERO instead
+BigInteger bi3 = new BigInteger(0.0); // reference BigInteger.ZERO instead
+BigInteger bi4;
+bi4 = new BigInteger(0); // reference BigInteger.ZERO instead
+]]>
+ </example>
+</rule>
+
+ <rule name="AvoidUsingOctalValues"
+ since="3.9"
+ message="Do not start a literal by 0 unless it's an octal value"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingOctalValuesRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidUsingOctalValues">
+ <description>
+ <![CDATA[
+Integer literals should not start with zero since this denotes that the rest of literal will be
+interpreted as an octal value.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+int i = 012; // set i with 10 not 12
+int j = 010; // set j with 8 not 10
+k = i * j; // set k with 80 not 120
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="AvoidUsingHardCodedIP"
+ since="4.1"
+ message="Do not hard code the IP address ${symbol_dollar}{variableName}"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingHardCodedIPRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidUsingHardCodedIP">
+ <description>
+ <![CDATA[
+Application with hard-coded IP addresses can become impossible to deploy in some cases.
+Externalizing IP adresses is preferable.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="pattern" type="String" description="Regular Expression" value='^"[0-9]{1,3}${symbol_escape}.[0-9]{1,3}${symbol_escape}.[0-9]{1,3}${symbol_escape}.[0-9]{1,3}"${symbol_dollar}'/>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo {
+ private String ip = "127.0.0.1"; // not recommended
+}
+ ]]>
+ </example>
+ </rule>
+
+ <!--
+ not available in maven-pmd-plugin ???
+ <rule name="CheckResultSet"
+ language="java"
+ since="4.1"
+ class="net.sourceforge.pmd.lang.java.rule.basic.CheckResultSetRule"
+ message="Always check the return of one of the navigation method (next,previous,first,last) of a ResultSet."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}CheckResultSet">
+ <description>
+ <![CDATA[
+Always check the return values of navigation methods (next, previous, first, last) of a ResultSet.
+If the value return is 'false', it should be handled properly.
+ ]]>
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+Statement stat = conn.createStatement();
+ResultSet rst = stat.executeQuery("SELECT name FROM person");
+rst.next(); // what if it returns false? bad form
+String firstName = rst.getString(1);
+
+Statement stat = conn.createStatement();
+ResultSet rst = stat.executeQuery("SELECT name FROM person");
+if (rst.next()) { // result is properly examined and used
+ String firstName = rst.getString(1);
+ } else {
+ // handle missing data
+}
+ ]]>
+ </example>
+ </rule>
+ -->
+
+ <rule name="AvoidMultipleUnaryOperators"
+ since="4.2"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidMultipleUnaryOperatorsRule"
+ message="Using multiple unary operators may be a bug, and/or is confusing."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidMultipleUnaryOperators">
+ <description>
+ <![CDATA[
+The use of multiple unary operators may be problematic, and/or confusing.
+Ensure that the intended usage is not a bug, or consider simplifying the expression.
+ ]]>
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+// These are typo bugs, or at best needlessly complex and confusing:
+int i = - -1;
+int j = + - +1;
+int z = ~~2;
+boolean b = !!true;
+boolean c = !!!true;
+
+// These are better:
+int i = 1;
+int j = -1;
+int z = 2;
+boolean b = true;
+boolean c = false;
+
+// And these just make your brain hurt:
+int i = ~-2;
+int j = -~7;
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="ExtendsObject"
+ language="java"
+ since="5.0"
+ message="No need to explicitly extend Object."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}ExtendsObject">
+ <description>No need to explicitly extend Object.</description>
+ <priority>4</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+ <![CDATA[
+//ExtendsList/ClassOrInterfaceType[@Image='Object' or @Image='java.lang.Object']
+ ]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+ <![CDATA[
+public class Foo extends Object { // not required
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="CheckSkipResult"
+ language="java"
+ since="5.0"
+ message="Check the value returned by the skip() method of an InputStream to see if the requested number of bytes has been skipped."
+ class="net.sourceforge.pmd.lang.java.rule.basic.CheckSkipResultRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}CheckSkipResult">
+ <description>The skip() method may skip a smaller number of bytes than requested. Check the returned value to find out if it was the case or not.</description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public class Foo {
+
+ private FileInputStream _s = new FileInputStream("file");
+
+ public void skip(int n) throws IOException {
+ _s.skip(n); // You are not sure that exactly n bytes are skipped
+ }
+
+ public void skipExactly(int n) throws IOException {
+ while (n != 0) {
+ long skipped = _s.skip(n);
+ if (skipped == 0)
+ throw new EOFException();
+ n -= skipped;
+ }
+ }
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="AvoidBranchingStatementAsLastInLoop"
+ since="5.0"
+ class="net.sourceforge.pmd.lang.java.rule.basic.AvoidBranchingStatementAsLastInLoopRule"
+ message="Avoid using a branching statement as the last in a loop."
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}AvoidBranchingStatementAsLastInLoop">
+ <description>
+ <![CDATA[
+Using a branching statement as the last part of a loop may be a bug, and/or is confusing.
+Ensure that the usage is not a bug, or consider using another approach.
+ ]]>
+ </description>
+ <priority>2</priority>
+ <example>
+ <![CDATA[
+ // unusual use of branching statement in a loop
+for (int i = 0; i < 10; i++) {
+ if (i*i <= 25) {
+ continue;
+ }
+ break;
+}
+
+ // this makes more sense...
+for (int i = 0; i < 10; i++) {
+ if (i*i > 25) {
+ break;
+ }
+}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="DontCallThreadRun"
+ language="java"
+ since="4.3"
+ message="Don't call Thread.run() explicitly, use Thread.start()"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}DontCallThreadRun">
+ <description>
+Explicitly calling Thread.run() method will execute in the caller's thread of control. Instead, call Thread.start() for the intended behavior.
+ </description>
+ <priority>4</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//StatementExpression/PrimaryExpression
+[
+ PrimaryPrefix
+ [
+ ./Name[ends-with(@Image, '.run') or @Image = 'run']
+ and substring-before(Name/@Image, '.') =//VariableDeclarator/VariableDeclaratorId/@Image
+ [../../../Type/ReferenceType[ClassOrInterfaceType/@Image = 'Thread']]
+ or (
+ ./AllocationExpression/ClassOrInterfaceType[@Image = 'Thread']
+ and ../PrimarySuffix[@Image = 'run'])
+ ]
+]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+Thread t = new Thread();
+t.run(); // use t.start() instead
+new Thread().run(); // same violation
+]]>
+ </example>
+ </rule>
+
+ <rule name="DontUseFloatTypeForLoopIndices"
+ language="java"
+ since="4.3"
+ message="Don't use floating point for loop indices. If you must use floating point, use double."
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html${symbol_pound}DontUseFloatTypeForLoopIndices">
+ <description>
+Don't use floating point for loop indices. If you must use floating point, use double
+unless you're certain that float provides enough precision and you have a compelling
+performance need (space or time).
+ </description>
+ <priority>3</priority>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//ForStatement/ForInit/LocalVariableDeclaration
+/Type/PrimitiveType[@Image="float"]
+]]>
+ </value>
+ </property>
+ </properties>
+ <example>
+<![CDATA[
+public class Count {
+ public static void main(String[] args) {
+ final int START = 2000000000;
+ int count = 0;
+ for (float f = START; f < START + 50; f++)
+ count++;
+ //Prints 0 because (float) START == (float) (START + 50).
+ System.out.println(count);
+ //The termination test misbehaves due to floating point granularity.
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyCatchBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyIfStmt" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyWhileStmt" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyTryBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyFinallyBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySwitchStatements" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySynchronizedBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementNotInLoop" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyInitializer" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementBlock" />
+ <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStaticInitializer" />
+
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryConversionTemporary" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryReturn" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryFinalModifier" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOverridingMethod" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOperationOnImmutable" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnusedNullCheckInEquals" />
+ <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessParentheses" />
+
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/imports.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/imports.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/imports.xml
new file mode 100644
index 0000000..28fc2a2
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/imports.xml
@@ -0,0 +1,148 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0"?>
+
+<ruleset name="Import Statements"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+
+ <description>
+These rules deal with different problems that can occur with import statements.
+ </description>
+
+ <rule name="DuplicateImports"
+ since="0.5"
+ message="Avoid duplicate imports such as ''{0}''"
+ class="net.sourceforge.pmd.lang.java.rule.imports.DuplicateImportsRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}DuplicateImports">
+ <description>
+Duplicate or overlapping import statements should be avoided.
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+import java.lang.String;
+import java.lang.*;
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="DontImportJavaLang"
+ since="0.5"
+ message="Avoid importing anything from the package 'java.lang'"
+ class="net.sourceforge.pmd.lang.java.rule.imports.DontImportJavaLangRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}DontImportJavaLang">
+ <description>
+Avoid importing anything from the package 'java.lang'. These classes are automatically imported (JLS 7.5.3).
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+import java.lang.String; // this is unnecessary
+
+public class Foo {}
+
+// --- in another source code file...
+
+import java.lang.*; // this is bad
+
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedImports"
+ since="1.0"
+ message="Avoid unused imports such as ''{0}''"
+ class="net.sourceforge.pmd.lang.java.rule.imports.UnusedImportsRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}UnusedImports">
+ <description>
+Avoid the use of unused import statements to prevent unwanted dependencies.
+ </description>
+ <priority>4</priority>
+ <example>
+<![CDATA[
+// this is bad
+import java.io.File;
+public class Foo {}
+]]>
+ </example>
+ </rule>
+
+ <rule name="ImportFromSamePackage"
+ since="1.02"
+ message="No need to import a type that lives in the same package"
+ class="net.sourceforge.pmd.lang.java.rule.imports.ImportFromSamePackageRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}ImportFromSamePackage">
+ <description>
+There is no need to import a type that lives in the same package.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+ package foo;
+
+ import foo.Buz; // no need for this
+ import foo.*; // or this
+
+ public class Bar{}
+ ]]>
+ </example>
+ </rule>
+
+ <rule name="TooManyStaticImports"
+ language="java"
+ since="4.1"
+ class="net.sourceforge.pmd.lang.rule.XPathRule"
+ message="Too many static imports may lead to messy code"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}TooManyStaticImports">
+ <description><![CDATA[
+If you overuse the static import feature, it can make your program unreadable and
+unmaintainable, polluting its namespace with all the static members you import.
+Readers of your code (including you, a few months after you wrote it) will not know
+which class a static member comes from (Sun 1.5 Language Guide).
+ ]]></description>
+ <priority>3</priority>
+ <properties>
+ <property name="maximumStaticImports" type="Integer"
+ description="All static imports can be disallowed by setting this to 0" min="0" max="100" value="4"/>
+ <property name="xpath">
+ <value><![CDATA[
+.[count(ImportDeclaration[@Static = 'true']) > ${symbol_dollar}maximumStaticImports]
+ ]]></value>
+ </property>
+ </properties>
+ <example><![CDATA[
+import static Lennon;
+import static Ringo;
+import static George;
+import static Paul;
+import static Yoko; // Too much !
+ ]]></example>
+ </rule>
+
+ <rule name="UnnecessaryFullyQualifiedName"
+ language="java"
+ since="5.0"
+ class="net.sourceforge.pmd.lang.java.rule.imports.UnnecessaryFullyQualifiedNameRule"
+ message="Unnecessary use of fully qualified name ''{0}'' due to existing import ''{1}''"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html${symbol_pound}UnnecessaryFullyQualifiedName">
+ <description><![CDATA[
+Import statements allow the use of non-fully qualified names. The use of a fully qualified name
+which is covered by an import statement is redundant. Consider using the non-fully qualified name.
+ ]]></description>
+ <priority>4</priority>
+ <example><![CDATA[
+import java.util.List;
+
+public class Foo {
+ private java.util.List list1; // Unnecessary FQN
+ private List list2; // More appropriate given import of 'java.util.List'
+}
+ ]]></example>
+ </rule>
+
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/rulesets.properties
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/rulesets.properties b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/rulesets.properties
new file mode 100644
index 0000000..0a1c2d3
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/rulesets.properties
@@ -0,0 +1,4 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+rulesets.filenames=rulesets/java/basic.xml,rulesets/java/imports.xml,rulesets/java/unusedcode.xml
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/unusedcode.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/unusedcode.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/unusedcode.xml
new file mode 100644
index 0000000..6e3d178
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd-rulesets/unusedcode.xml
@@ -0,0 +1,128 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0"?>
+
+<ruleset name="Unused Code"
+ xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+ <description>
+The Unused Code ruleset contains rules that find unused or ineffective code.
+ </description>
+
+ <rule name="UnusedPrivateField"
+ since="0.1"
+ language="java"
+ message="Avoid unused private fields such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateFieldRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedPrivateField">
+ <description>
+Detects when a private field is declared and/or assigned a value, but not used.
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+public class Something {
+ private static int FOO = 2; // Unused
+ private int i = 5; // Unused
+ private int j = 6;
+ public int addOne() {
+ return j++;
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedLocalVariable"
+ language="java"
+ since="0.1"
+ message="Avoid unused local variables such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedLocalVariableRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedLocalVariable">
+ <description>
+Detects when a local variable is declared and/or assigned, but not used.
+ </description>
+ <priority>3</priority>
+
+ <example>
+<![CDATA[
+public class Foo {
+ public void doSomething() {
+ int i = 5; // Unused
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedPrivateMethod"
+ language="java"
+ since="0.7"
+ message="Avoid unused private methods such as ''{0}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateMethodRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedPrivateMethod">
+ <description>
+Unused Private Method detects when a private method is declared but is unused.
+ </description>
+ <priority>3</priority>
+ <example>
+<![CDATA[
+public class Something {
+ private void foo() {} // unused
+}
+]]>
+ </example>
+ </rule>
+
+
+ <rule name="UnusedFormalParameter"
+ language="java"
+ since="0.8"
+ message="Avoid unused {0} parameters such as ''{1}''."
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedFormalParameterRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedFormalParameter">
+ <description>
+Avoid passing parameters to methods or constructors without actually referencing them in the method body.
+ </description>
+ <priority>3</priority>
+
+ <example>
+<![CDATA[
+public class Foo {
+ private void bar(String howdy) {
+ // howdy is not used
+ }
+}
+]]>
+ </example>
+ </rule>
+
+ <rule name="UnusedModifier"
+ language="java"
+ since="1.02"
+ message="Avoid modifiers which are implied by the context"
+ class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedModifierRule"
+ externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html${symbol_pound}UnusedModifier">
+ <description>
+Fields in interfaces are automatically public static final, and methods are public abstract.
+Classes or interfaces nested in an interface are automatically public and static (all nested interfaces are automatically static).
+For historical reasons, modifiers which are implied by the context are accepted by the compiler, but are superfluous.
+ </description>
+ <priority>3</priority>
+ <example>
+ <![CDATA[
+public interface Foo {
+ public abstract void bar(); // both abstract and public are ignored by the compiler
+ public static final int X = 0; // public, static, and final all ignored
+ public static class Bar {} // public, static ignored
+ public static interface Baz {} // ditto
+}
+public class Bar {
+ public static interface Baz {} // static ignored
+}
+ ]]>
+ </example>
+ </rule>
+ </ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd.xml
new file mode 100644
index 0000000..ac23283
--- /dev/null
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checks/pmd.xml
@@ -0,0 +1,49 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<ruleset name="Maven Ruleset"
+ xmlns="http://pmd.sf.net/ruleset/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
+ xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+
+ <!--
+ Customized PMD ruleset for Maven, see [0] for more information
+ [0] http://pmd.sourceforge.net/howtomakearuleset.html
+ -->
+
+ <description>
+ This ruleset checks the code for discouraged programming constructs.
+ </description>
+
+ <rule ref="pmd-rulesets/basic.xml">
+ <exclude name="EmptyCatchBlock"/>
+ </rule>
+ <rule ref="pmd-rulesets/basic.xml/EmptyCatchBlock">
+ <properties>
+ <property name="allowCommentedBlocks" value="true"/>
+ </properties>
+ </rule>
+
+ <rule ref="pmd-rulesets/unusedcode.xml"/>
+ <rule ref="pmd-rulesets/imports.xml"/>
+</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checkstyle.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checkstyle.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checkstyle.xml
deleted file mode 100644
index 1d57a99..0000000
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/checkstyle.xml
+++ /dev/null
@@ -1,290 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
-
-<!--
-
- Checkstyle configuration that checks the sun coding conventions from:
-
- - the Java Language Specification at
- http://java.sun.com/docs/books/jls/second_edition/html/index.html
-
- - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
-
- - the Javadoc guidelines at
- http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
-
- - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
-
- - some best practices
-
- Checkstyle is very configurable. Be sure to read the documentation at
- http://checkstyle.sf.net (or in your downloaded distribution).
-
- Most Checks are configurable, be sure to consult the documentation.
-
- To completely disable a check, just comment it out or delete it from the file.
-
- Finally, it is worth reading the documentation.
-
--->
-
-<module name="Checker">
-
- <!-- Checks that a package.html file exists for each package. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html${symbol_pound}PackageHtml -->
- <module name="JavadocPackage"/>
- <!--
- -->
-
- <!-- Checks whether files end with a new line. -->
- <!-- See http://checkstyle.sf.net/config_misc.html${symbol_pound}NewlineAtEndOfFile -->
- <!--
- <module name="NewlineAtEndOfFile"/>
- -->
-
- <!-- Checks that property files contain the same keys. -->
- <!-- See http://checkstyle.sf.net/config_misc.html${symbol_pound}Translation -->
- <module name="Translation"/>
-
- <!--
- eg:
- //CHECKSTYLE.OFF: IllegalCatch - Much more readable than catching 7 exceptions
- catch (Exception e)
- //CHECKSTYLE.ON: IllegalCatch
- -->
- <module name="SuppressionCommentFilter">
- <property name="offCommentFormat" value="CHECKSTYLE.OFF${symbol_escape}: ([${symbol_escape}w${symbol_escape}|]+)"/>
- <property name="onCommentFormat" value="CHECKSTYLE.ON${symbol_escape}: ([${symbol_escape}w${symbol_escape}|]+)"/>
- <property name="checkFormat" value="${symbol_dollar}1"/>
- </module>
-
- <!--
- eg:
- // CHECKSTYLE IGNORE check FOR NEXT 1 LINES
- public void onClick(View view) { ... } -->
- <module name="SuppressWithNearbyCommentFilter">
- <property name="commentFormat" value="CHECKSTYLE.IGNORE (${symbol_escape}w+) FOR NEXT (${symbol_escape}d+) LINES"/>
- <property name="checkFormat" value="${symbol_dollar}1"/>
- <property name="influenceFormat" value="${symbol_dollar}2"/>
- </module>
-
- <module name="TreeWalker">
-
- <property name="cacheFile" value="${symbol_dollar}{checkstyle.cache.file}"/>
-
- <!-- not available in eclipse-cs
- <module name="JavadocDeprecated"/>
- -->
- <module name="MissingOverride"/>
-
- <!-- ************************************************************** -->
- <!-- Checks that are different from the sun coding conventions ones -->
- <!-- ************************************************************** -->
- <property name="tabWidth" value="4"/>
- <module name="LeftCurly">
- <property name="option" value="eol"/>
- </module>
- <module name="RightCurly">
- <property name="option" value="same"/>
- </module>
- <module name="MemberName">
- <property name="format" value="^[a-z]([a-zA-Z0-9])*${symbol_dollar}"/>
- </module>
- <module name="StaticVariableName">
- <property name="format" value="^[A-Z](_?[A-Z0-9])*${symbol_dollar}"/>
- </module>
- <module name="MethodName">
- <property name="format" value="[a-z](_?[a-zA-Z0-9]+)*${symbol_dollar}"/>
- </module>
- <module name="ParameterName">
- <property name="format" value="[a-z]([a-zA-Z0-9]+)*${symbol_dollar}"/>
- </module>
- <module name="LocalVariableName">
- <property name="format" value="[a-z]([a-zA-Z0-9]+)*${symbol_dollar}"/>
- </module>
-
- <!-- ************************************************************** -->
- <!-- Default Sun coding conventions checks -->
- <!-- ************************************************************** -->
-
- <!-- Checks for Javadoc comments. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html -->
-
- <!-- TODO: instate at some point (though only for public methods
- <module name="JavadocType"/>
- -->
- <!--
- <module name="JavadocMethod"/>
- <module name="JavadocVariable"/>
- -->
-
-
- <!-- Checks for Naming Conventions. -->
- <!-- See http://checkstyle.sf.net/config_naming.html -->
- <module name="ConstantName"/>
- <module name="PackageName"/>
- <module name="TypeName"/>
- <module name="LocalFinalVariableName"/>
-
-
- <!-- Checks for Headers -->
- <!-- See http://checkstyle.sf.net/config_header.html -->
- <!--
- <module name="Header">
- -->
- <!-- The follow property value demonstrates the ability -->
- <!-- to have access to ANT properties. In this case it uses -->
- <!-- the ${symbol_dollar}{basedir} property to allow Checkstyle to be run -->
- <!-- from any directory within a project. -->
- <!--
- <property name="headerFile" value="${symbol_dollar}{checkstyle.header.file}"/>
- </module>
- -->
-
- <!-- Following interprets the header file as regular expressions. -->
- <!-- <module name="RegexpHeader"/> -->
-
-
- <!-- Checks for imports -->
- <!-- See http://checkstyle.sf.net/config_import.html -->
- <module name="AvoidStarImport"/>
- <module name="IllegalImport"/>
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
-
-
- <!-- Checks for blocks. You know, those {}'s -->
- <!-- See http://checkstyle.sf.net/config_blocks.html -->
- <module name="EmptyBlock"/>
- <module name="NeedBraces"/>
- <!--
- <module name="AvoidNestedBlocks"/>
- -->
-
-
- <!-- Checks for common coding problems -->
- <!-- See http://checkstyle.sf.net/config_coding.html -->
- <module name="EmptyStatement"/>
- <module name="MagicNumber"/>
- <module name="MissingSwitchDefault"/>
- <module name="RedundantThrows"/>
- <module name="SimplifyBooleanExpression"/>
- <module name="SimplifyBooleanReturn"/>
-
- <!-- not supported in maven
- <module name="DoubleCheckedLocking"/>
- -->
- <!--
- <module name="AvoidInlineConditionals"/>
- <module name="EqualsHashCode"/>
- <module name="HiddenField"/>
- <module name="IllegalInstantiation"/>
- <module name="InnerAssignment"/>
- -->
-
- <!-- Checks for class design -->
- <!-- See http://checkstyle.sf.net/config_design.html -->
- <!--
-
- <module name="VisibilityModifier"/>
- -->
- <!-- too many violations...
- <module name="DesignForExtension"/>
- -->
- <module name="FinalClass"/>
- <module name="HideUtilityClassConstructor"/>
- <module name="InterfaceIsType"/>
-
-
- <module name="CyclomaticComplexity">
- <property name="max" value="12"/>
- </module>
- <module name="NPathComplexity">
- <property name="max" value="160"/>
- </module>
-
- <!-- Miscellaneous other checks. -->
- <!-- See http://checkstyle.sf.net/config_misc.html -->
- <!--
- <module name="ArrayTypeStyle"/>
- <module name="GenericIllegalRegexp">
- <property name="format" value="${symbol_escape}s+${symbol_dollar}"/>
- <property name="message" value="Line has trailing spaces."/>
- </module>
- -->
- <!-- removed; we detect these in other ways.
- <module name="TodoComment"/>
- -->
- <module name="UpperEll"/>
- <module name="FinalParameters"/>
-
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <!--
- <module name="NoWhitespaceAfter"/>
- <module name="NoWhitespaceBefore"/>
- <module name="OperatorWrap"/>
- <module name="ParenPad"/>
- <module name="WhitespaceAfter"/>
- <module name="WhitespaceAround"/>
- <module name="TabCharacter"/>
- -->
- <module name="EmptyForIteratorPad"/>
-
-
- <!-- Modifier Checks -->
- <!-- See http://checkstyle.sf.net/config_modifiers.html -->
- <!--
- <module name="ModifierOrder"/>
- <module name="RedundantModifier"/>
- -->
-
- <!-- Checks for Size Violations. -->
- <!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="LineLength">
- <property name="max" value="120"/>
- </module>
- <module name="MethodLength">
- <property name="max" value="30"/>
- </module>
- <module name="ParameterNumber">
- <property name="max" value="6"/>
- </module>
-
- </module>
-
-
-
- <module name="FileLength">
- <property name="max" value="1500"/>
- </module>
-
- <module name="FileTabCharacter">
- <property name="eachLine" value="true"/>
- <property name="fileExtensions" value="java,xml"/>
- </module>
-
-</module>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/pom.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/pom.xml
index a131ff8..0870a2a 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/pom.xml
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/pom.xml
@@ -109,8 +109,8 @@
<properties>
<danhaywood-mavenmixin-isisvalidate>domainapp.modules.simple.SimpleModuleManifest</danhaywood-mavenmixin-isisvalidate>
- <danhaywood-mavenmixin-staticanalysis.checkstyle.configLocation>${project.basedir}/../checkstyle.xml</danhaywood-mavenmixin-staticanalysis.checkstyle.configLocation>
- <danhaywood-mavenmixin-staticanalysis.pmd.ruleset>${project.basedir}/../pmd.xml</danhaywood-mavenmixin-staticanalysis.pmd.ruleset>
+ <danhaywood-mavenmixin-staticanalysis.checkstyle.configLocation>${project.basedir}/../checks/checkstyle.xml</danhaywood-mavenmixin-staticanalysis.checkstyle.configLocation>
+ <danhaywood-mavenmixin-staticanalysis.pmd.ruleset>${project.basedir}/../checks/pmd.xml</danhaywood-mavenmixin-staticanalysis.pmd.ruleset>
</properties>
<dependencies>
http://git-wip-us.apache.org/repos/asf/isis/blob/6f428cee/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
----------------------------------------------------------------------
diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
index f17494e..c96f2e8 100644
--- a/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
+++ b/example/archetype/simpleapp/src/main/resources/archetype-resources/modules/module-simple/translations.pot
@@ -23,7 +23,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
-"POT-Creation-Date: 2016-11-24 10:28:23+\n"
+"POT-Creation-Date: 2016-11-24 11:36:24+\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
[06/11] isis git commit: ISIS-1538: moves static analysis check files
to subdirectory
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/pmd-rulesets/basic.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/pmd-rulesets/basic.xml b/example/application/simpleapp/modules/pmd-rulesets/basic.xml
deleted file mode 100644
index f18af2c..0000000
--- a/example/application/simpleapp/modules/pmd-rulesets/basic.xml
+++ /dev/null
@@ -1,807 +0,0 @@
-<?xml version="1.0"?>
-
-<ruleset name="Basic"
- xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
- <description>
-The Basic ruleset contains a collection of good practices which should be followed.
- </description>
-
- <rule name="JumbledIncrementer"
- language="java"
- since="1.0"
- message="Avoid modifying an outer loop incrementer in an inner loop for update expression"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#JumbledIncrementer">
- <description>
-Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//ForStatement
- [
- ForUpdate/StatementExpressionList/StatementExpression/PostfixExpression/PrimaryExpression/PrimaryPrefix/Name/@Image
- =
- ancestor::ForStatement/ForInit//VariableDeclaratorId/@Image
- ]
- ]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class JumbledIncrementerRule1 {
- public void foo() {
- for (int i = 0; i < 10; i++) { // only references 'i'
- for (int k = 0; k < 20; i++) { // references both 'i' and 'k'
- System.out.println("Hello");
- }
- }
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="ForLoopShouldBeWhileLoop"
- language="java"
- since="1.02"
- message="This for loop could be simplified to a while loop"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ForLoopShouldBeWhileLoop">
- <description>
-Some for loops can be simplified to while loops, this makes them more concise.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//ForStatement
- [count(*) > 1]
- [not(LocalVariableDeclaration)]
- [not(ForInit)]
- [not(ForUpdate)]
- [not(Type and Expression and Statement)]
- ]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Foo {
- void bar() {
- for (;true;) true; // No Init or Update part, may as well be: while (true)
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="OverrideBothEqualsAndHashcode"
- language="java"
- since="0.4"
- message="Ensure you override both equals() and hashCode()"
- class="net.sourceforge.pmd.lang.java.rule.basic.OverrideBothEqualsAndHashcodeRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#OverrideBothEqualsAndHashcode">
- <description>
-Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
- </description>
- <priority>3</priority>
- <example>
- <![CDATA[
-public class Bar { // poor, missing a hashcode() method
- public boolean equals(Object o) {
- // do some comparison
- }
-}
-
-public class Baz { // poor, missing an equals() method
- public int hashCode() {
- // return some hash value
- }
-}
-
-public class Foo { // perfect, both methods provided
- public boolean equals(Object other) {
- // do some comparison
- }
- public int hashCode() {
- // return some hash value
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="DoubleCheckedLocking"
- language="java"
- since="1.04"
- message="Double checked locking is not thread safe in Java."
- class="net.sourceforge.pmd.lang.java.rule.basic.DoubleCheckedLockingRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#DoubleCheckedLocking">
- <description>
-Partially created objects can be returned by the Double Checked Locking pattern when used in Java.
-An optimizing JRE may assign a reference to the baz variable before it creates the object the
-reference is intended to point to.
-
-For more details refer to: http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html
- </description>
- <priority>1</priority>
- <example>
- <![CDATA[
-public class Foo {
- Object baz;
- Object bar() {
- if (baz == null) { // baz may be non-null yet not fully created
- synchronized(this) {
- if (baz == null) {
- baz = new Object();
- }
- }
- }
- return baz;
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="ReturnFromFinallyBlock"
- language="java"
- since="1.05"
- message="Avoid returning from a finally block"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ReturnFromFinallyBlock">
- <description>
-Avoid returning from a finally block, this can discard exceptions.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//FinallyStatement//ReturnStatement
-]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Bar {
- public String foo() {
- try {
- throw new Exception( "My Exception" );
- } catch (Exception e) {
- throw e;
- } finally {
- return "A. O. K."; // return not recommended here
- }
- }
-}
-]]>
- </example>
- </rule>
-
- <rule name="UnconditionalIfStatement"
- language="java"
- since="1.5"
- message="Do not use 'if' statements that are always true or always false"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#UnconditionalIfStatement">
- <description>
-Do not use "if" statements whose conditionals are always true or always false.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//IfStatement/Expression
- [count(PrimaryExpression)=1]
- /PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral
-]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Foo {
- public void close() {
- if (true) { // fixed conditional, not recommended
- // ...
- }
- }
-}
-]]>
- </example>
- </rule>
-
- <rule name="BooleanInstantiation"
- since="1.2"
- message="Avoid instantiating Boolean objects; reference Boolean.TRUE or Boolean.FALSE or call Boolean.valueOf() instead."
- class="net.sourceforge.pmd.lang.java.rule.basic.BooleanInstantiationRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#BooleanInstantiation">
- <description>
-Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boolean.valueOf() instead.
- </description>
- <priority>2</priority>
- <example>
- <![CDATA[
-Boolean bar = new Boolean("true"); // unnecessary creation, just reference Boolean.TRUE;
-Boolean buz = Boolean.valueOf(false); // ...., just reference Boolean.FALSE;
- ]]>
- </example>
- </rule>
-
- <rule name="CollapsibleIfStatements"
- language="java"
- since="3.1"
- message="These nested if statements could be combined"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#CollapsibleIfStatements">
- <description>
-Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//IfStatement[@Else='false']/Statement
- /IfStatement[@Else='false']
- |
-//IfStatement[@Else='false']/Statement
- /Block[count(BlockStatement)=1]/BlockStatement
- /Statement/IfStatement[@Else='false']]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-void bar() {
- if (x) { // original implementation
- if (y) {
- // do stuff
- }
- }
-}
-
-void bar() {
- if (x && y) { // optimized implementation
- // do stuff
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="ClassCastExceptionWithToArray"
- language="java"
- since="3.4"
- message="This usage of the Collection.toArray() method will throw a ClassCastException."
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ClassCastExceptionWithToArray">
- <description>
-When deriving an array of a specific class from your Collection, one should provide an array of
-the same class as the parameter of the toArray() method. Doing otherwise you will will result
-in a ClassCastException.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//CastExpression[Type/ReferenceType/ClassOrInterfaceType[@Image !=
-"Object"]]/PrimaryExpression
-[
- PrimaryPrefix/Name[ends-with(@Image, '.toArray')]
- and
- PrimarySuffix/Arguments[count(*) = 0]
-and
-count(PrimarySuffix) = 1
-]
-]]>
- </value>
- </property>
- </properties>
- <example>
-<![CDATA[
-Collection c = new ArrayList();
-Integer obj = new Integer(1);
-c.add(obj);
-
- // this would trigger the rule (and throw a ClassCastException if executed)
-Integer[] a = (Integer [])c.toArray();
-
- // this is fine and will not trigger the rule
-Integer[] b = (Integer [])c.toArray(new Integer[c.size()]);
-]]>
- </example>
-</rule>
-
-
-<rule name="AvoidDecimalLiteralsInBigDecimalConstructor"
- language="java"
- since="3.4"
- message="Avoid creating BigDecimal with a decimal (float/double) literal. Use a String literal"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidDecimalLiteralsInBigDecimalConstructor">
- <description>
-One might assume that the result of "new BigDecimal(0.1)" is exactly equal to 0.1, but it is actually
-equal to .1000000000000000055511151231257827021181583404541015625.
-This is because 0.1 cannot be represented exactly as a double (or as a binary fraction of any finite
-length). Thus, the long value that is being passed in to the constructor is not exactly equal to 0.1,
-appearances notwithstanding.
-
-The (String) constructor, on the other hand, is perfectly predictable: 'new BigDecimal("0.1")' is
-exactly equal to 0.1, as one would expect. Therefore, it is generally recommended that the
-(String) constructor be used in preference to this one.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//AllocationExpression[ClassOrInterfaceType[@Image="BigDecimal"]
-and
-./Arguments/ArgumentList
-/Expression/PrimaryExpression/PrimaryPrefix/Literal[(not
-(ends-with
-(@Image,'"'))) and contains(@Image,".")]]
- ]]>
- </value>
- </property>
- </properties>
- <example>
-<![CDATA[
-BigDecimal bd = new BigDecimal(1.123); // loss of precision, this would trigger the rule
-
-BigDecimal bd = new BigDecimal("1.123"); // preferred approach
-
-BigDecimal bd = new BigDecimal(12); // preferred approach, ok for integer values
-]]>
- </example>
-</rule>
-
-
- <rule name="MisplacedNullCheck"
- language="java"
- since="3.5"
- message="The null check here is misplaced; if the variable is null there'll be a NullPointerException"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#MisplacedNullCheck">
- <description>
-The null check here is misplaced. If the variable is null a NullPointerException will be thrown.
-Either the check is useless (the variable will never be "null") or it is incorrect.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//Expression
- /*[self::ConditionalOrExpression or self::ConditionalAndExpression]
- /descendant::PrimaryExpression/PrimaryPrefix
- /Name[starts-with(@Image,
- concat(ancestor::PrimaryExpression/following-sibling::EqualityExpression
- [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
- /PrimaryExpression/PrimaryPrefix
- /Name[count(../../PrimarySuffix)=0]/@Image,".")
- )
- ]
- [count(ancestor::ConditionalAndExpression/EqualityExpression
- [@Image='!=']
- [./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
- [starts-with(following-sibling::*/PrimaryExpression/PrimaryPrefix/Name/@Image,
- concat(./PrimaryExpression/PrimaryPrefix/Name/@Image, '.'))]
- ) = 0
- ]
- ]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Foo {
- void bar() {
- if (a.equals(baz) && a != null) {}
- }
-}
- ]]>
- </example>
- <example><![CDATA[
-public class Foo {
- void bar() {
- if (a.equals(baz) || a == null) {}
- }
-}
- ]]></example>
- </rule>
-
-
- <rule name="AvoidThreadGroup"
- language="java"
- since="3.6"
- message="Avoid using java.lang.ThreadGroup; it is not thread safe"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidThreadGroup"
- typeResolution="true">
- <description>
-Avoid using java.lang.ThreadGroup; although it is intended to be used in a threaded environment
-it contains methods that are not thread-safe.
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//AllocationExpression/ClassOrInterfaceType[pmd-java:typeof(@Image, 'java.lang.ThreadGroup')]|
-//PrimarySuffix[contains(@Image, 'getThreadGroup')]
-]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Bar {
- void buz() {
- ThreadGroup tg = new ThreadGroup("My threadgroup") ;
- tg = new ThreadGroup(tg, "my thread group");
- tg = Thread.currentThread().getThreadGroup();
- tg = System.getSecurityManager().getThreadGroup();
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="BrokenNullCheck"
- since="3.8"
- message="Method call on object which may be null"
- class="net.sourceforge.pmd.lang.java.rule.basic.BrokenNullCheckRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#BrokenNullCheck">
- <description>
-The null check is broken since it will throw a NullPointerException itself.
-It is likely that you used || instead of && or vice versa.
- </description>
- <priority>2</priority>
- <example>
-<![CDATA[
-public String bar(String string) {
- // should be &&
- if (string!=null || !string.equals(""))
- return string;
- // should be ||
- if (string==null && string.equals(""))
- return string;
-}
- ]]>
- </example>
- </rule>
-
- <rule name="BigIntegerInstantiation"
- since="3.9"
- message="Don't create instances of already existing BigInteger and BigDecimal (ZERO, ONE, TEN)"
- class="net.sourceforge.pmd.lang.java.rule.basic.BigIntegerInstantiationRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#BigIntegerInstantiation">
- <description>
-Don't create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) and
-for Java 1.5 onwards, BigInteger.TEN and BigDecimal (BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN)
- </description>
- <priority>3</priority>
- <example>
-<![CDATA[
-BigInteger bi = new BigInteger(1); // reference BigInteger.ONE instead
-BigInteger bi2 = new BigInteger("0"); // reference BigInteger.ZERO instead
-BigInteger bi3 = new BigInteger(0.0); // reference BigInteger.ZERO instead
-BigInteger bi4;
-bi4 = new BigInteger(0); // reference BigInteger.ZERO instead
-]]>
- </example>
-</rule>
-
- <rule name="AvoidUsingOctalValues"
- since="3.9"
- message="Do not start a literal by 0 unless it's an octal value"
- class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingOctalValuesRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidUsingOctalValues">
- <description>
- <![CDATA[
-Integer literals should not start with zero since this denotes that the rest of literal will be
-interpreted as an octal value.
- ]]>
- </description>
- <priority>3</priority>
- <example>
- <![CDATA[
-int i = 012; // set i with 10 not 12
-int j = 010; // set j with 8 not 10
-k = i * j; // set k with 80 not 120
- ]]>
- </example>
- </rule>
-
- <rule name="AvoidUsingHardCodedIP"
- since="4.1"
- message="Do not hard code the IP address ${variableName}"
- class="net.sourceforge.pmd.lang.java.rule.basic.AvoidUsingHardCodedIPRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidUsingHardCodedIP">
- <description>
- <![CDATA[
-Application with hard-coded IP addresses can become impossible to deploy in some cases.
-Externalizing IP adresses is preferable.
- ]]>
- </description>
- <priority>3</priority>
- <properties>
- <property name="pattern" type="String" description="Regular Expression" value='^"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"$'/>
- </properties>
- <example>
- <![CDATA[
-public class Foo {
- private String ip = "127.0.0.1"; // not recommended
-}
- ]]>
- </example>
- </rule>
-
- <!--
- not available in maven-pmd-plugin ???
- <rule name="CheckResultSet"
- language="java"
- since="4.1"
- class="net.sourceforge.pmd.lang.java.rule.basic.CheckResultSetRule"
- message="Always check the return of one of the navigation method (next,previous,first,last) of a ResultSet."
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#CheckResultSet">
- <description>
- <![CDATA[
-Always check the return values of navigation methods (next, previous, first, last) of a ResultSet.
-If the value return is 'false', it should be handled properly.
- ]]>
- </description>
- <priority>3</priority>
- <example>
- <![CDATA[
-Statement stat = conn.createStatement();
-ResultSet rst = stat.executeQuery("SELECT name FROM person");
-rst.next(); // what if it returns false? bad form
-String firstName = rst.getString(1);
-
-Statement stat = conn.createStatement();
-ResultSet rst = stat.executeQuery("SELECT name FROM person");
-if (rst.next()) { // result is properly examined and used
- String firstName = rst.getString(1);
- } else {
- // handle missing data
-}
- ]]>
- </example>
- </rule>
- -->
-
- <rule name="AvoidMultipleUnaryOperators"
- since="4.2"
- class="net.sourceforge.pmd.lang.java.rule.basic.AvoidMultipleUnaryOperatorsRule"
- message="Using multiple unary operators may be a bug, and/or is confusing."
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidMultipleUnaryOperators">
- <description>
- <![CDATA[
-The use of multiple unary operators may be problematic, and/or confusing.
-Ensure that the intended usage is not a bug, or consider simplifying the expression.
- ]]>
- </description>
- <priority>2</priority>
- <example>
- <![CDATA[
-// These are typo bugs, or at best needlessly complex and confusing:
-int i = - -1;
-int j = + - +1;
-int z = ~~2;
-boolean b = !!true;
-boolean c = !!!true;
-
-// These are better:
-int i = 1;
-int j = -1;
-int z = 2;
-boolean b = true;
-boolean c = false;
-
-// And these just make your brain hurt:
-int i = ~-2;
-int j = -~7;
- ]]>
- </example>
- </rule>
-
- <rule name="ExtendsObject"
- language="java"
- since="5.0"
- message="No need to explicitly extend Object."
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#ExtendsObject">
- <description>No need to explicitly extend Object.</description>
- <priority>4</priority>
- <properties>
- <property name="xpath">
- <value>
- <![CDATA[
-//ExtendsList/ClassOrInterfaceType[@Image='Object' or @Image='java.lang.Object']
- ]]>
- </value>
- </property>
- </properties>
- <example>
- <![CDATA[
-public class Foo extends Object { // not required
-}
- ]]>
- </example>
- </rule>
-
- <rule name="CheckSkipResult"
- language="java"
- since="5.0"
- message="Check the value returned by the skip() method of an InputStream to see if the requested number of bytes has been skipped."
- class="net.sourceforge.pmd.lang.java.rule.basic.CheckSkipResultRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#CheckSkipResult">
- <description>The skip() method may skip a smaller number of bytes than requested. Check the returned value to find out if it was the case or not.</description>
- <priority>3</priority>
- <example>
- <![CDATA[
-public class Foo {
-
- private FileInputStream _s = new FileInputStream("file");
-
- public void skip(int n) throws IOException {
- _s.skip(n); // You are not sure that exactly n bytes are skipped
- }
-
- public void skipExactly(int n) throws IOException {
- while (n != 0) {
- long skipped = _s.skip(n);
- if (skipped == 0)
- throw new EOFException();
- n -= skipped;
- }
- }
- ]]>
- </example>
- </rule>
-
- <rule name="AvoidBranchingStatementAsLastInLoop"
- since="5.0"
- class="net.sourceforge.pmd.lang.java.rule.basic.AvoidBranchingStatementAsLastInLoopRule"
- message="Avoid using a branching statement as the last in a loop."
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#AvoidBranchingStatementAsLastInLoop">
- <description>
- <![CDATA[
-Using a branching statement as the last part of a loop may be a bug, and/or is confusing.
-Ensure that the usage is not a bug, or consider using another approach.
- ]]>
- </description>
- <priority>2</priority>
- <example>
- <![CDATA[
- // unusual use of branching statement in a loop
-for (int i = 0; i < 10; i++) {
- if (i*i <= 25) {
- continue;
- }
- break;
-}
-
- // this makes more sense...
-for (int i = 0; i < 10; i++) {
- if (i*i > 25) {
- break;
- }
-}
- ]]>
- </example>
- </rule>
-
- <rule name="DontCallThreadRun"
- language="java"
- since="4.3"
- message="Don't call Thread.run() explicitly, use Thread.start()"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#DontCallThreadRun">
- <description>
-Explicitly calling Thread.run() method will execute in the caller's thread of control. Instead, call Thread.start() for the intended behavior.
- </description>
- <priority>4</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//StatementExpression/PrimaryExpression
-[
- PrimaryPrefix
- [
- ./Name[ends-with(@Image, '.run') or @Image = 'run']
- and substring-before(Name/@Image, '.') =//VariableDeclarator/VariableDeclaratorId/@Image
- [../../../Type/ReferenceType[ClassOrInterfaceType/@Image = 'Thread']]
- or (
- ./AllocationExpression/ClassOrInterfaceType[@Image = 'Thread']
- and ../PrimarySuffix[@Image = 'run'])
- ]
-]
-]]>
- </value>
- </property>
- </properties>
- <example>
-<![CDATA[
-Thread t = new Thread();
-t.run(); // use t.start() instead
-new Thread().run(); // same violation
-]]>
- </example>
- </rule>
-
- <rule name="DontUseFloatTypeForLoopIndices"
- language="java"
- since="4.3"
- message="Don't use floating point for loop indices. If you must use floating point, use double."
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/basic.html#DontUseFloatTypeForLoopIndices">
- <description>
-Don't use floating point for loop indices. If you must use floating point, use double
-unless you're certain that float provides enough precision and you have a compelling
-performance need (space or time).
- </description>
- <priority>3</priority>
- <properties>
- <property name="xpath">
- <value>
-<![CDATA[
-//ForStatement/ForInit/LocalVariableDeclaration
-/Type/PrimitiveType[@Image="float"]
-]]>
- </value>
- </property>
- </properties>
- <example>
-<![CDATA[
-public class Count {
- public static void main(String[] args) {
- final int START = 2000000000;
- int count = 0;
- for (float f = START; f < START + 50; f++)
- count++;
- //Prints 0 because (float) START == (float) (START + 50).
- System.out.println(count);
- //The termination test misbehaves due to floating point granularity.
- }
-}
-]]>
- </example>
- </rule>
-
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyCatchBlock" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyIfStmt" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyWhileStmt" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyTryBlock" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyFinallyBlock" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySwitchStatements" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptySynchronizedBlock" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementNotInLoop" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyInitializer" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStatementBlock" />
- <rule deprecated="true" ref="rulesets/java/empty.xml/EmptyStaticInitializer" />
-
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryConversionTemporary" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryReturn" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnnecessaryFinalModifier" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOverridingMethod" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessOperationOnImmutable" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UnusedNullCheckInEquals" />
- <rule deprecated="true" ref="rulesets/java/unnecessary.xml/UselessParentheses" />
-
-</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/pmd-rulesets/imports.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/pmd-rulesets/imports.xml b/example/application/simpleapp/modules/pmd-rulesets/imports.xml
deleted file mode 100644
index 8948262..0000000
--- a/example/application/simpleapp/modules/pmd-rulesets/imports.xml
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0"?>
-
-<ruleset name="Import Statements"
- xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
-
- <description>
-These rules deal with different problems that can occur with import statements.
- </description>
-
- <rule name="DuplicateImports"
- since="0.5"
- message="Avoid duplicate imports such as ''{0}''"
- class="net.sourceforge.pmd.lang.java.rule.imports.DuplicateImportsRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#DuplicateImports">
- <description>
-Duplicate or overlapping import statements should be avoided.
- </description>
- <priority>4</priority>
- <example>
-<![CDATA[
-import java.lang.String;
-import java.lang.*;
-public class Foo {}
-]]>
- </example>
- </rule>
-
- <rule name="DontImportJavaLang"
- since="0.5"
- message="Avoid importing anything from the package 'java.lang'"
- class="net.sourceforge.pmd.lang.java.rule.imports.DontImportJavaLangRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#DontImportJavaLang">
- <description>
-Avoid importing anything from the package 'java.lang'. These classes are automatically imported (JLS 7.5.3).
- </description>
- <priority>4</priority>
- <example>
-<![CDATA[
-import java.lang.String; // this is unnecessary
-
-public class Foo {}
-
-// --- in another source code file...
-
-import java.lang.*; // this is bad
-
-public class Foo {}
-]]>
- </example>
- </rule>
-
- <rule name="UnusedImports"
- since="1.0"
- message="Avoid unused imports such as ''{0}''"
- class="net.sourceforge.pmd.lang.java.rule.imports.UnusedImportsRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#UnusedImports">
- <description>
-Avoid the use of unused import statements to prevent unwanted dependencies.
- </description>
- <priority>4</priority>
- <example>
-<![CDATA[
-// this is bad
-import java.io.File;
-public class Foo {}
-]]>
- </example>
- </rule>
-
- <rule name="ImportFromSamePackage"
- since="1.02"
- message="No need to import a type that lives in the same package"
- class="net.sourceforge.pmd.lang.java.rule.imports.ImportFromSamePackageRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#ImportFromSamePackage">
- <description>
-There is no need to import a type that lives in the same package.
- </description>
- <priority>3</priority>
- <example>
- <![CDATA[
- package foo;
-
- import foo.Buz; // no need for this
- import foo.*; // or this
-
- public class Bar{}
- ]]>
- </example>
- </rule>
-
- <rule name="TooManyStaticImports"
- language="java"
- since="4.1"
- class="net.sourceforge.pmd.lang.rule.XPathRule"
- message="Too many static imports may lead to messy code"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#TooManyStaticImports">
- <description><![CDATA[
-If you overuse the static import feature, it can make your program unreadable and
-unmaintainable, polluting its namespace with all the static members you import.
-Readers of your code (including you, a few months after you wrote it) will not know
-which class a static member comes from (Sun 1.5 Language Guide).
- ]]></description>
- <priority>3</priority>
- <properties>
- <property name="maximumStaticImports" type="Integer"
- description="All static imports can be disallowed by setting this to 0" min="0" max="100" value="4"/>
- <property name="xpath">
- <value><![CDATA[
-.[count(ImportDeclaration[@Static = 'true']) > $maximumStaticImports]
- ]]></value>
- </property>
- </properties>
- <example><![CDATA[
-import static Lennon;
-import static Ringo;
-import static George;
-import static Paul;
-import static Yoko; // Too much !
- ]]></example>
- </rule>
-
- <rule name="UnnecessaryFullyQualifiedName"
- language="java"
- since="5.0"
- class="net.sourceforge.pmd.lang.java.rule.imports.UnnecessaryFullyQualifiedNameRule"
- message="Unnecessary use of fully qualified name ''{0}'' due to existing import ''{1}''"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/imports.html#UnnecessaryFullyQualifiedName">
- <description><![CDATA[
-Import statements allow the use of non-fully qualified names. The use of a fully qualified name
-which is covered by an import statement is redundant. Consider using the non-fully qualified name.
- ]]></description>
- <priority>4</priority>
- <example><![CDATA[
-import java.util.List;
-
-public class Foo {
- private java.util.List list1; // Unnecessary FQN
- private List list2; // More appropriate given import of 'java.util.List'
-}
- ]]></example>
- </rule>
-
-</ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/pmd-rulesets/rulesets.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/pmd-rulesets/rulesets.properties b/example/application/simpleapp/modules/pmd-rulesets/rulesets.properties
deleted file mode 100644
index d95e632..0000000
--- a/example/application/simpleapp/modules/pmd-rulesets/rulesets.properties
+++ /dev/null
@@ -1 +0,0 @@
-rulesets.filenames=rulesets/java/basic.xml,rulesets/java/imports.xml,rulesets/java/unusedcode.xml
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/pmd-rulesets/unusedcode.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/pmd-rulesets/unusedcode.xml b/example/application/simpleapp/modules/pmd-rulesets/unusedcode.xml
deleted file mode 100644
index 802d18f..0000000
--- a/example/application/simpleapp/modules/pmd-rulesets/unusedcode.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0"?>
-
-<ruleset name="Unused Code"
- xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
- <description>
-The Unused Code ruleset contains rules that find unused or ineffective code.
- </description>
-
- <rule name="UnusedPrivateField"
- since="0.1"
- language="java"
- message="Avoid unused private fields such as ''{0}''."
- class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateFieldRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedPrivateField">
- <description>
-Detects when a private field is declared and/or assigned a value, but not used.
- </description>
- <priority>3</priority>
- <example>
-<![CDATA[
-public class Something {
- private static int FOO = 2; // Unused
- private int i = 5; // Unused
- private int j = 6;
- public int addOne() {
- return j++;
- }
-}
-]]>
- </example>
- </rule>
-
- <rule name="UnusedLocalVariable"
- language="java"
- since="0.1"
- message="Avoid unused local variables such as ''{0}''."
- class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedLocalVariableRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedLocalVariable">
- <description>
-Detects when a local variable is declared and/or assigned, but not used.
- </description>
- <priority>3</priority>
-
- <example>
-<![CDATA[
-public class Foo {
- public void doSomething() {
- int i = 5; // Unused
- }
-}
-]]>
- </example>
- </rule>
-
- <rule name="UnusedPrivateMethod"
- language="java"
- since="0.7"
- message="Avoid unused private methods such as ''{0}''."
- class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedPrivateMethodRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedPrivateMethod">
- <description>
-Unused Private Method detects when a private method is declared but is unused.
- </description>
- <priority>3</priority>
- <example>
-<![CDATA[
-public class Something {
- private void foo() {} // unused
-}
-]]>
- </example>
- </rule>
-
-
- <rule name="UnusedFormalParameter"
- language="java"
- since="0.8"
- message="Avoid unused {0} parameters such as ''{1}''."
- class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedFormalParameterRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedFormalParameter">
- <description>
-Avoid passing parameters to methods or constructors without actually referencing them in the method body.
- </description>
- <priority>3</priority>
-
- <example>
-<![CDATA[
-public class Foo {
- private void bar(String howdy) {
- // howdy is not used
- }
-}
-]]>
- </example>
- </rule>
-
- <rule name="UnusedModifier"
- language="java"
- since="1.02"
- message="Avoid modifiers which are implied by the context"
- class="net.sourceforge.pmd.lang.java.rule.unusedcode.UnusedModifierRule"
- externalInfoUrl="http://pmd.sourceforge.net/pmd-5.0.5/rules/java/unusedcode.html#UnusedModifier">
- <description>
-Fields in interfaces are automatically public static final, and methods are public abstract.
-Classes or interfaces nested in an interface are automatically public and static (all nested interfaces are automatically static).
-For historical reasons, modifiers which are implied by the context are accepted by the compiler, but are superfluous.
- </description>
- <priority>3</priority>
- <example>
- <![CDATA[
-public interface Foo {
- public abstract void bar(); // both abstract and public are ignored by the compiler
- public static final int X = 0; // public, static, and final all ignored
- public static class Bar {} // public, static ignored
- public static interface Baz {} // ditto
-}
-public class Bar {
- public static interface Baz {} // static ignored
-}
- ]]>
- </example>
- </rule>
- </ruleset>
http://git-wip-us.apache.org/repos/asf/isis/blob/f921dc5d/example/application/simpleapp/modules/pmd.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/modules/pmd.xml b/example/application/simpleapp/modules/pmd.xml
deleted file mode 100644
index dbaf4af..0000000
--- a/example/application/simpleapp/modules/pmd.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<ruleset name="Maven Ruleset"
- xmlns="http://pmd.sf.net/ruleset/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
- xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
-
- <!--
- Customized PMD ruleset for Maven, see [0] for more information
- [0] http://pmd.sourceforge.net/howtomakearuleset.html
- -->
-
- <description>
- This ruleset checks the code for discouraged programming constructs.
- </description>
-
- <rule ref="pmd-rulesets/basic.xml">
- <exclude name="EmptyCatchBlock"/>
- </rule>
- <rule ref="pmd-rulesets/basic.xml/EmptyCatchBlock">
- <properties>
- <property name="allowCommentedBlocks" value="true"/>
- </properties>
- </rule>
-
- <rule ref="pmd-rulesets/unusedcode.xml"/>
- <rule ref="pmd-rulesets/imports.xml"/>
-</ruleset>
[10/11] isis git commit: ISIS-1538: makes some very minor tweaks to
the pom.xml of the simpleapp.
Posted by da...@apache.org.
ISIS-1538: makes some very minor tweaks to the pom.xml of the simpleapp.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/83eb1763
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/83eb1763
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/83eb1763
Branch: refs/heads/maint-1.13.2
Commit: 83eb1763f97519ac85fea56928e0a4779058ebfb
Parents: 6f428ce
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Nov 24 16:04:08 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 24 16:04:08 2016 +0000
----------------------------------------------------------------------
.../application/simpleapp/application/pom.xml | 4 ++
example/application/simpleapp/pom.xml | 42 +++++++++++++++-----
example/application/simpleapp/webapp/pom.xml | 16 ++++++++
3 files changed, 52 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/83eb1763/example/application/simpleapp/application/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/application/pom.xml b/example/application/simpleapp/application/pom.xml
index 2eb8607..06c3c18 100644
--- a/example/application/simpleapp/application/pom.xml
+++ b/example/application/simpleapp/application/pom.xml
@@ -101,11 +101,15 @@
</build>
<dependencies>
+
+ <!-- this app -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>simpleapp-module-simple</artifactId>
</dependency>
+
+ <!-- isis -->
<dependency>
<groupId>org.apache.isis.core</groupId>
<artifactId>isis-core-wrapper</artifactId>
http://git-wip-us.apache.org/repos/asf/isis/blob/83eb1763/example/application/simpleapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/pom.xml b/example/application/simpleapp/pom.xml
index 8d0d11e..64d931b 100644
--- a/example/application/simpleapp/pom.xml
+++ b/example/application/simpleapp/pom.xml
@@ -37,7 +37,7 @@
<isis.version>1.14.0-SNAPSHOT</isis.version>
<lombok.version>1.16.10</lombok.version>
- <assertj-core.version>2.4.0</assertj-core.version>
+ <assertj-core.version>3.6.0</assertj-core.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@@ -58,15 +58,42 @@
<repository>
<id>Cloudbees snapshots</id>
<url>http://repository-estatio.forge.cloudbees.com/snapshot/</url>
+ <name>CloudBees Snapshots (and Interim Releases)</name>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </snapshots>
+ <layout>default</layout>
+ </repository>
+ <repository>
+ <id>sonatype-snapshots</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
</repository>
</repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>estatio.snapshots</id>
+ <name>CloudBees Snapshots (and Interim Releases)</name>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </releases>
+ <url>http://repository-estatio.forge.cloudbees.com/snapshot/</url>
+ <layout>default</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
<modules>
<module>modules/module-simple</module>
<module>application</module>
@@ -84,12 +111,6 @@
<scope>import</scope>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj-core.version}</version>
- </dependency>
-
<!-- this project's own modules -->
<dependency>
<groupId>${project.groupId}</groupId>
@@ -107,6 +128,7 @@
<version>${project.version}</version>
</dependency>
+ <!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
http://git-wip-us.apache.org/repos/asf/isis/blob/83eb1763/example/application/simpleapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/pom.xml b/example/application/simpleapp/webapp/pom.xml
index d01d182..8cb3c3c 100644
--- a/example/application/simpleapp/webapp/pom.xml
+++ b/example/application/simpleapp/webapp/pom.xml
@@ -62,6 +62,19 @@
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <version>1.4</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
@@ -112,11 +125,14 @@
</build>
<dependencies>
+
+ <!-- this app -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>simpleapp-application</artifactId>
</dependency>
+ <!-- isis -->
<dependency>
<groupId>com.danhaywood.mavendeps</groupId>
<artifactId>isiswebapp</artifactId>
[04/11] isis git commit: ISIS-1538: updates script to recreate
archetypes,
no need to run the archetype ITs (which have for some reason now started
failing)
Posted by da...@apache.org.
ISIS-1538: updates script to recreate archetypes, no need to run the archetype ITs (which have for some reason now started failing)
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/57b71118
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/57b71118
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/57b71118
Branch: refs/heads/maint-1.13.2
Commit: 57b71118ebc09bd002c2fc6922b466a6e3fd4717
Parents: 792be3e
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Nov 24 11:25:03 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 24 11:25:18 2016 +0000
----------------------------------------------------------------------
scripts/updateGeneratedArchetypeSources.groovy | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/57b71118/scripts/updateGeneratedArchetypeSources.groovy
----------------------------------------------------------------------
diff --git a/scripts/updateGeneratedArchetypeSources.groovy b/scripts/updateGeneratedArchetypeSources.groovy
index 5d56cc8..96d12bb 100644
--- a/scripts/updateGeneratedArchetypeSources.groovy
+++ b/scripts/updateGeneratedArchetypeSources.groovy
@@ -125,6 +125,11 @@ pomXml.appendNode {
}
pomXml.groupId='org.apache.isis.archetype'
+def fragmentToAdd = new XmlSlurper( false, true ).parseText( '''<properties>
+ <archetype.test.skip>true</archetype.test.skip>
+</properties>''' )
+pomXml.appendNode(fragmentToAdd)
+
def pomSmb = new groovy.xml.StreamingMarkupBuilder().bind {
mkp.declareNamespace("":"http://maven.apache.org/POM/4.0.0")
mkp.yield(pomXml)