From 8c25e9c22ceda7cfaf01c76142dc4d168132c1ee Mon Sep 17 00:00:00 2001 From: Gareth Healy Date: Thu, 7 Sep 2017 19:40:48 +0100 Subject: [PATCH] Updated checkstyle rules (#510) --- .../camel-checkstyle-suppressions.xml | 70 ---- .../src/main/resources/camel-checkstyle.xml | 361 ----------------- .../resources/checkstyle-suppressions.xml | 45 +++ .../src/main/resources/loose-checkstyle.xml | 56 +++ .../src/main/resources/strict-checkstyle.xml | 211 ++++++++++ .../resources/upstream-camel-checkstyle.xml | 367 ------------------ core/pom.xml | 7 +- plugins-parent/pom.xml | 19 +- .../dozermapper/protobuf/util/ProtoUtils.java | 44 +-- 9 files changed, 353 insertions(+), 827 deletions(-) delete mode 100644 building-tools/src/main/resources/camel-checkstyle-suppressions.xml delete mode 100644 building-tools/src/main/resources/camel-checkstyle.xml create mode 100644 building-tools/src/main/resources/checkstyle-suppressions.xml create mode 100644 building-tools/src/main/resources/loose-checkstyle.xml create mode 100644 building-tools/src/main/resources/strict-checkstyle.xml delete mode 100644 building-tools/src/main/resources/upstream-camel-checkstyle.xml diff --git a/building-tools/src/main/resources/camel-checkstyle-suppressions.xml b/building-tools/src/main/resources/camel-checkstyle-suppressions.xml deleted file mode 100644 index eec46582f..000000000 --- a/building-tools/src/main/resources/camel-checkstyle-suppressions.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/building-tools/src/main/resources/camel-checkstyle.xml b/building-tools/src/main/resources/camel-checkstyle.xml deleted file mode 100644 index 85271f73d..000000000 --- a/building-tools/src/main/resources/camel-checkstyle.xml +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/building-tools/src/main/resources/checkstyle-suppressions.xml b/building-tools/src/main/resources/checkstyle-suppressions.xml new file mode 100644 index 000000000..46271d323 --- /dev/null +++ b/building-tools/src/main/resources/checkstyle-suppressions.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/building-tools/src/main/resources/loose-checkstyle.xml b/building-tools/src/main/resources/loose-checkstyle.xml new file mode 100644 index 000000000..3ff475803 --- /dev/null +++ b/building-tools/src/main/resources/loose-checkstyle.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/building-tools/src/main/resources/strict-checkstyle.xml b/building-tools/src/main/resources/strict-checkstyle.xml new file mode 100644 index 000000000..8d9724629 --- /dev/null +++ b/building-tools/src/main/resources/strict-checkstyle.xml @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/building-tools/src/main/resources/upstream-camel-checkstyle.xml b/building-tools/src/main/resources/upstream-camel-checkstyle.xml deleted file mode 100644 index cada29542..000000000 --- a/building-tools/src/main/resources/upstream-camel-checkstyle.xml +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core/pom.xml b/core/pom.xml index 8aadbd7b2..4485c3163 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -190,6 +190,7 @@ org.apache.maven.plugins maven-checkstyle-plugin + false com.github.dozermapper @@ -202,9 +203,9 @@ validate validate - - camel-checkstyle.xml - camel-checkstyle-suppressions.xml + + loose-checkstyle.xml + checkstyle-suppressions.xml true true true diff --git a/plugins-parent/pom.xml b/plugins-parent/pom.xml index 9c2d38ef3..d4a6eb809 100644 --- a/plugins-parent/pom.xml +++ b/plugins-parent/pom.xml @@ -352,23 +352,34 @@ com.github.dozermapper - building-tools + dozer-building-tools ${building-tools.version} compile + + com.puppycrawl.tools + checkstyle + 8.0 + compile + + + com.github.sevntu-checkstyle + sevntu-checkstyle-maven-plugin + 1.24.2 + compile + validate validate - upstream-camel-checkstyle.xml - camel-checkstyle-suppressions.xml + strict-checkstyle.xml + checkstyle-suppressions.xml true true true UTF-8 - ${basedir}/src check diff --git a/proto/src/main/java/com/github/dozermapper/protobuf/util/ProtoUtils.java b/proto/src/main/java/com/github/dozermapper/protobuf/util/ProtoUtils.java index 76a922327..8649e0ba6 100644 --- a/proto/src/main/java/com/github/dozermapper/protobuf/util/ProtoUtils.java +++ b/proto/src/main/java/com/github/dozermapper/protobuf/util/ProtoUtils.java @@ -191,28 +191,28 @@ public static Class getJavaGenericClassForCollection(final Descriptors.FieldD private static Class getJavaClassIgnoreRepeated(final Descriptors.FieldDescriptor descriptor, BeanContainer beanContainer) { switch (descriptor.getJavaType()) { - case INT: - return Integer.class; - case LONG: - return Long.class; - case FLOAT: - return Float.class; - case DOUBLE: - return Double.class; - case BOOLEAN: - return Boolean.class; - case STRING: - return String.class; - case BYTE_STRING: - return ByteString.class; - //code duplicate, but GenericDescriptor interface is private in protobuf - case ENUM: - return getEnumClassByEnumDescriptor(descriptor.getEnumType(), beanContainer); - case MESSAGE: - return MappingUtils.loadClass(StringUtils.join( - getFullyQualifiedClassName(descriptor.getMessageType().getFile().getOptions(), descriptor.getMessageType().getName()), '.'), beanContainer); - default: - throw new RuntimeException(); + case INT: + return Integer.class; + case LONG: + return Long.class; + case FLOAT: + return Float.class; + case DOUBLE: + return Double.class; + case BOOLEAN: + return Boolean.class; + case STRING: + return String.class; + case BYTE_STRING: + return ByteString.class; + //code duplicate, but GenericDescriptor interface is private in protobuf + case ENUM: + return getEnumClassByEnumDescriptor(descriptor.getEnumType(), beanContainer); + case MESSAGE: + return MappingUtils.loadClass(StringUtils.join( + getFullyQualifiedClassName(descriptor.getMessageType().getFile().getOptions(), descriptor.getMessageType().getName()), '.'), beanContainer); + default: + throw new RuntimeException(); } }