diff --git a/Jenkinsfile b/Jenkinsfile index 98be1d7..1cf7aed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,6 +37,10 @@ pipeline { jacoco classPattern: 'target/classes', execPattern: 'target/jacoco.exec', sourcePattern: 'src/main/java', exclusionPattern:'iudx/gis/server/apiserver/*.class,**/*VertxEBProxy.class,**/Constants.class,**/*VertxProxyHandler.class,**/*Verticle.class,iudx/gis/server/deploy/*.class,iudx/gis/server/databroker/DataBrokerService.class,iudx/gis/server/databroker/DataBrokerServiceImpl.class,iudx/gis/server/apiserver/validation/types/Validator.class,iudx/gis/server/metering/MeteringService.class,iudx/gis/server/cache/CacheService.class,iudx/gis/server/database/postgres/PostgresService.class,**/*JwtDataConverter.class' } post{ + always { + recordIssues enabledForFailure: true, tool: checkStyle(pattern: 'target/checkstyle-result.xml') + recordIssues enabledForFailure: true, tool: pmdParser(pattern: 'target/pmd.xml') + } failure{ script{ sh 'docker compose -f docker-compose.test.yml down --remove-orphans' diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 2970d06..bc23b52 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -17,6 +17,8 @@ services: - /home/ubuntu/configs/keystore-gis.jks:/usr/share/app/configs/keystore.jks - ./docker/runTests.sh:/usr/share/app/docker/runTests.sh - ./src/:/usr/share/app/src + - ./iudx-pmd-ruleset.xml:/usr/share/app/iudx-pmd-ruleset.xml + - ./google_checks.xml:/usr/share/app/google_checks.xml - ${WORKSPACE}:/tmp/test - /var/run/docker.sock:/var/run/docker.sock network_mode: host diff --git a/docker/depl.dockerfile b/docker/depl.dockerfile index 4c79bbe..0c4140e 100644 --- a/docker/depl.dockerfile +++ b/docker/depl.dockerfile @@ -22,6 +22,8 @@ ENV JAR="iudx.gis.interface-cluster-${VERSION}-fat.jar" WORKDIR /usr/share/app # Copying openapi docs COPY docs docs +COPY iudx-pmd-ruleset.xml iudx-pmd-ruleset.xml +COPY google_checks.xml google_checks.xml # Copying cluster fatjar from builder stage to final image COPY --from=builder /usr/share/app/target/${JAR} ./fatjar.jar diff --git a/docker/dev.dockerfile b/docker/dev.dockerfile index d996871..aaf4dff 100644 --- a/docker/dev.dockerfile +++ b/docker/dev.dockerfile @@ -20,6 +20,8 @@ ENV JAR="iudx.gis.interface-dev-${VERSION}-fat.jar" WORKDIR /usr/share/app # Copying openapi docs COPY docs docs +COPY iudx-pmd-ruleset.xml iudx-pmd-ruleset.xml +COPY google_checks.xml google_checks.xml # Copying dev fatjar from builder stage to final image COPY --from=builder /usr/share/app/target/${JAR} ./fatjar.jar diff --git a/docker/runTests.sh b/docker/runTests.sh index 22ccd68..bfa1c2c 100755 --- a/docker/runTests.sh +++ b/docker/runTests.sh @@ -2,5 +2,5 @@ nohup mvn clean compile exec:java@gis-server & sleep 20 -mvn clean test +mvn clean test checkstyle:checkstyle pmd:pmd cp -r target /tmp/test/ \ No newline at end of file diff --git a/google_checks.xml b/google_checks.xml index 9127154..fae66e0 100644 --- a/google_checks.xml +++ b/google_checks.xml @@ -1,22 +1,21 @@ <?xml version="1.0"?> <!DOCTYPE module PUBLIC - "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" - "https://checkstyle.org/dtds/configuration_1_3.dtd"> + "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" + "https://checkstyle.org/dtds/configuration_1_3.dtd"> <!-- Checkstyle configuration that checks the Google coding conventions from Google Java Style that can be found at https://google.github.io/styleguide/javaguide.html - Checkstyle is very configurable. Be sure to read the documentation at http://checkstyle.org (or in your downloaded distribution). - To completely disable a check, just comment it out or delete it from the file. To suppress certain violations please review suppression filters. - Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov. --> -<module name = "Checker"> +<module name="Checker"> + <module name="SuppressWarningsFilter"/> + <property name="charset" value="UTF-8"/> <property name="severity" value="warning"/> @@ -42,7 +41,7 @@ <module name="LineLength"> <property name="fileExtensions" value="java"/> - <property name="max" value="100"/> + <property name="max" value="120"/> <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> </module> @@ -51,16 +50,20 @@ <module name="IllegalTokenText"> <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/> <property name="format" - value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/> + value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/> <property name="message" - value="Consider using special escape sequence instead of octal value or Unicode escaped value."/> + value="Consider using special escape sequence instead of octal value or Unicode escaped value."/> </module> <module name="AvoidEscapedUnicodeCharacters"> <property name="allowEscapesForControlCharacters" value="true"/> <property name="allowByTailComment" value="true"/> <property name="allowNonPrintableEscapes" value="true"/> </module> - <module name="AvoidStarImport"/> + <!-- <module name="AvoidStarImport"/>--> + <module name="AvoidStarImport"> + <property name="allowStaticMemberImports" value="true"/> + <property name="allowClassImports" value="true"/> + </module> <module name="OneTopLevelClass"/> <module name="NoLineWrap"> <property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT"/> @@ -68,43 +71,46 @@ <module name="EmptyBlock"> <property name="option" value="TEXT"/> <property name="tokens" - value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> + value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> </module> <module name="NeedBraces"> <property name="tokens" - value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/> + value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/> </module> <module name="LeftCurly"> <property name="tokens" - value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF, + value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF, INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF, - OBJBLOCK, STATIC_INIT"/> + OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF"/> </module> <module name="RightCurly"> <property name="id" value="RightCurlySame"/> <property name="tokens" - value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, + value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/> </module> <module name="RightCurly"> <property name="id" value="RightCurlyAlone"/> <property name="option" value="alone"/> <property name="tokens" - value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, - INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF"/> + value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, + INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, INTERFACE_DEF, RECORD_DEF, + COMPACT_CTOR_DEF"/> </module> <module name="SuppressionXpathSingleFilter"> - <!-- suppresion is required till https://github.com/checkstyle/checkstyle/issues/7541 --> - <property name="id" value="RightCurlyAlone"/> - <property name="query" value="//RCURLY[parent::SLIST[count(./*)=1] - or preceding-sibling::*[last()][self::LCURLY]]"/> + <!-- suppresion is required till https://github.com/checkstyle/checkstyle/issues/7541 --> + <property name="id" value="RightCurlyAlone"/> + <property name="query" value="//RCURLY[parent::SLIST[count(./*)=1] + or preceding-sibling::*[last()][self::LCURLY]]"/> </module> <module name="WhitespaceAfter"> <property name="tokens" - value="COMMA, SEMI, TYPECAST, LITERAL_IF, LITERAL_ELSE, - LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, DO_WHILE"/> + value="COMMA, SEMI, TYPECAST, LITERAL_IF, LITERAL_ELSE, LITERAL_RETURN, + LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, LITERAL_FINALLY, DO_WHILE, ELLIPSIS, + LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_CATCH, LAMBDA, + LITERAL_YIELD, LITERAL_CASE"/> </module> <module name="WhitespaceAround"> <property name="allowEmptyConstructors" value="true"/> @@ -112,18 +118,20 @@ <property name="allowEmptyMethods" value="true"/> <property name="allowEmptyTypes" value="true"/> <property name="allowEmptyLoops" value="true"/> + <property name="ignoreEnhancedForColon" value="false"/> <property name="tokens" - value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, + value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND, LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, - LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, - NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, - SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/> + LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, + NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, + SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/> <message key="ws.notFollowed" - value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/> + value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks + may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/> <message key="ws.notPreceded" - value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/> + value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/> </module> <module name="OneStatementPerLine"/> <module name="MultipleVariableDeclarations"/> @@ -134,8 +142,9 @@ <module name="ModifierOrder"/> <module name="EmptyLineSeparator"> <property name="tokens" - value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF, - STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> + value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF, + STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF, RECORD_DEF, + COMPACT_CTOR_DEF"/> <property name="allowNoEmptyLineBetweenFields" value="true"/> </module> <module name="SeparatorWrap"> @@ -149,13 +158,13 @@ <property name="option" value="EOL"/> </module> <module name="SeparatorWrap"> - <!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 --> + <!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/259 --> <property name="id" value="SeparatorWrapEllipsis"/> <property name="tokens" value="ELLIPSIS"/> <property name="option" value="EOL"/> </module> <module name="SeparatorWrap"> - <!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 --> + <!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/258 --> <property name="id" value="SeparatorWrapArrayDeclarator"/> <property name="tokens" value="ARRAY_DECLARATOR"/> <property name="option" value="EOL"/> @@ -168,22 +177,23 @@ <module name="PackageName"> <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/> <message key="name.invalidPattern" - value="Package name ''{0}'' must match pattern ''{1}''."/> + value="Package name ''{0}'' must match pattern ''{1}''."/> </module> <module name="TypeName"> - <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF"/> + <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, + ANNOTATION_DEF, RECORD_DEF"/> <message key="name.invalidPattern" - value="Type name ''{0}'' must match pattern ''{1}''."/> + value="Type name ''{0}'' must match pattern ''{1}''."/> </module> <module name="MemberName"> <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/> <message key="name.invalidPattern" - value="Member name ''{0}'' must match pattern ''{1}''."/> + value="Member name ''{0}'' must match pattern ''{1}''."/> </module> <module name="ParameterName"> <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> <message key="name.invalidPattern" - value="Parameter name ''{0}'' must match pattern ''{1}''."/> + value="Parameter name ''{0}'' must match pattern ''{1}''."/> </module> <module name="LambdaParameterName"> <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> @@ -193,42 +203,57 @@ <module name="CatchParameterName"> <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> <message key="name.invalidPattern" - value="Catch parameter name ''{0}'' must match pattern ''{1}''."/> + value="Catch parameter name ''{0}'' must match pattern ''{1}''."/> </module> <module name="LocalVariableName"> <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> <message key="name.invalidPattern" - value="Local variable name ''{0}'' must match pattern ''{1}''."/> + value="Local variable name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="PatternVariableName"> + <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> + <message key="name.invalidPattern" + value="Pattern variable name ''{0}'' must match pattern ''{1}''."/> </module> <module name="ClassTypeParameterName"> <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> <message key="name.invalidPattern" - value="Class type name ''{0}'' must match pattern ''{1}''."/> + value="Class type name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="RecordComponentName"> + <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> + <message key="name.invalidPattern" + value="Record component name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="RecordTypeParameterName"> + <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> + <message key="name.invalidPattern" + value="Record type name ''{0}'' must match pattern ''{1}''."/> </module> <module name="MethodTypeParameterName"> <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> <message key="name.invalidPattern" - value="Method type name ''{0}'' must match pattern ''{1}''."/> + value="Method type name ''{0}'' must match pattern ''{1}''."/> </module> <module name="InterfaceTypeParameterName"> <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> <message key="name.invalidPattern" - value="Interface type name ''{0}'' must match pattern ''{1}''."/> + value="Interface type name ''{0}'' must match pattern ''{1}''."/> </module> <module name="NoFinalizer"/> <module name="GenericWhitespace"> <message key="ws.followed" - value="GenericWhitespace ''{0}'' is followed by whitespace."/> + value="GenericWhitespace ''{0}'' is followed by whitespace."/> <message key="ws.preceded" - value="GenericWhitespace ''{0}'' is preceded with whitespace."/> + value="GenericWhitespace ''{0}'' is preceded with whitespace."/> <message key="ws.illegalFollow" - value="GenericWhitespace ''{0}'' should followed by whitespace."/> + value="GenericWhitespace ''{0}'' should followed by whitespace."/> <message key="ws.notPreceded" - value="GenericWhitespace ''{0}'' is not preceded with whitespace."/> + value="GenericWhitespace ''{0}'' is not preceded with whitespace."/> </module> <module name="Indentation"> <property name="basicOffset" value="2"/> - <property name="braceAdjustment" value="0"/> + <property name="braceAdjustment" value="2"/> <property name="caseIndent" value="2"/> <property name="throwsIndent" value="4"/> <property name="lineWrappingIndentation" value="4"/> @@ -236,11 +261,13 @@ </module> <module name="AbbreviationAsWordInName"> <property name="ignoreFinal" value="false"/> - <property name="allowedAbbreviationLength" value="1"/> + <property name="allowedAbbreviationLength" value="0"/> <property name="tokens" - value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF, - PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF"/> + value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF, + PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF, PATTERN_VARIABLE_DEF, RECORD_DEF, + RECORD_COMPONENT_DEF"/> </module> + <module name="NoWhitespaceBeforeCaseDefaultColon"/> <module name="OverloadMethodsDeclarationOrder"/> <module name="VariableDeclarationUsageDistance"/> <module name="CustomImportOrder"> @@ -251,32 +278,35 @@ </module> <module name="MethodParamPad"> <property name="tokens" - value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, - SUPER_CTOR_CALL, ENUM_CONSTANT_DEF"/> + value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, + SUPER_CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF"/> </module> <module name="NoWhitespaceBefore"> <property name="tokens" - value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, + value="COMMA, SEMI, POST_INC, POST_DEC, DOT, LABELED_STAT, METHOD_REF"/> <property name="allowLineBreaks" value="true"/> </module> <module name="ParenPad"> <property name="tokens" - value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, ENUM_CONSTANT_DEF, + value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, ENUM_CONSTANT_DEF, EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL, - METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA"/> + METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA, + RECORD_DEF"/> </module> <module name="OperatorWrap"> <property name="option" value="NL"/> <property name="tokens" - value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, - LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/> + value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, + LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF, + TYPE_EXTENSION_AND "/> </module> <module name="AnnotationLocation"> <property name="id" value="AnnotationLocationMostCases"/> <property name="tokens" - value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/> + value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, + RECORD_DEF, COMPACT_CTOR_DEF"/> </module> <module name="AnnotationLocation"> <property name="id" value="AnnotationLocationVariables"/> @@ -286,37 +316,45 @@ <module name="NonEmptyAtclauseDescription"/> <module name="InvalidJavadocPosition"/> <module name="JavadocTagContinuationIndentation"/> - <module name="SummaryJavadoc"> - <property name="forbiddenSummaryFragments" - value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/> - </module> + <!-- <module name="SummaryJavadoc"> + <property name="forbiddenSummaryFragments" + value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/> + </module>--> <module name="JavadocParagraph"/> + <module name="RequireEmptyLineBeforeBlockTagGroup"/> <module name="AtclauseOrder"> <property name="tagOrder" value="@param, @return, @throws, @deprecated"/> <property name="target" - value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> + value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> </module> <module name="JavadocMethod"> - <property name="scope" value="public"/> + <property name="accessModifiers" value="public"/> <property name="allowMissingParamTags" value="true"/> <property name="allowMissingReturnTag" value="true"/> <property name="allowedAnnotations" value="Override, Test"/> - <property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/> + <property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF"/> </module> <module name="MissingJavadocMethod"> - <property name="scope" value="public"/> + <!--<property name="scope" value="public"/>--> + <property name="excludeScope" value="public"/> <property name="minLineCount" value="2"/> <property name="allowedAnnotations" value="Override, Test"/> - <property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/> + <property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, + COMPACT_CTOR_DEF"/> + </module> + <module name="MissingJavadocType"> + <property name="scope" value="protected"/> + <property name="tokens" + value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, + RECORD_DEF, ANNOTATION_DEF"/> + <property name="excludeScope" value="private"/> </module> <module name="MethodName"> - <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/> + <property name="format" value="^[a-z][a-z0-9]\w*$"/> <message key="name.invalidPattern" - value="Method name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="SingleLineJavadoc"> - <property name="ignoreInlineTags" value="false"/> + value="Method name ''{0}'' must match pattern ''{1}''."/> </module> + <module name="SingleLineJavadoc"/> <module name="EmptyCatchBlock"> <property name="exceptionVariableName" value="expected"/> </module> @@ -329,5 +367,18 @@ default="checkstyle-xpath-suppressions.xml" /> <property name="optional" value="true"/> </module> + <module name="SuppressWarningsHolder" /> + <module name="SuppressionCommentFilter"> + <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)" /> + <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)" /> + <property name="checkFormat" value="$1" /> + </module> + <module name="SuppressWithNearbyCommentFilter"> + <property name="commentFormat" value="CHECKSTYLE.SUPPRESS\: ([\w\|]+)"/> + <!-- $1 refers to the first match group in the regex defined in commentFormat --> + <property name="checkFormat" value="$1"/> + <!-- The check is suppressed in the next line of code after the comment --> + <property name="influenceFormat" value="1"/> + </module> </module> </module> \ No newline at end of file diff --git a/iudx-pmd-ruleset.xml b/iudx-pmd-ruleset.xml new file mode 100644 index 0000000..a7b1ba8 --- /dev/null +++ b/iudx-pmd-ruleset.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<ruleset name="IUDX PMD RULESET" + 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 default ruleset used by the Maven PMD Plugin, when no other ruleset is specified. + </description> + + <rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" /> + <rule ref="category/java/bestpractices.xml/CheckResultSet" /> + <rule ref="category/java/bestpractices.xml/PrimitiveWrapperInstantiation" /> + <rule ref="category/java/bestpractices.xml/UnusedFormalParameter" /> + <rule ref="category/java/bestpractices.xml/UnusedLocalVariable" /> + <rule ref="category/java/bestpractices.xml/UnusedPrivateField" /> + <rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" /> + + <rule ref="category/java/codestyle.xml/EmptyControlStatement" /> + <rule ref="category/java/codestyle.xml/ExtendsObject" /> + <rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" /> + <rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName" /> + <!--<rule ref="category/java/codestyle.xml/UnnecessaryImport" />--> + <rule ref="category/java/codestyle.xml/UnnecessaryModifier" /> + <rule ref="category/java/codestyle.xml/UnnecessaryReturn" /> + <rule ref="category/java/codestyle.xml/UnnecessarySemicolon" /> + <rule ref="category/java/codestyle.xml/UselessParentheses" /> + <rule ref="category/java/codestyle.xml/UselessQualifiedThis" /> + + <rule ref="category/java/design.xml/CollapsibleIfStatements" /> + <rule ref="category/java/design.xml/SimplifiedTernary" /> + <rule ref="category/java/design.xml/UselessOverridingMethod" /> + <rule ref="category/java/codestyle.xml/TooManyStaticImports"> + <properties> + <property name="maximumStaticImports" value="100" /> + </properties> + </rule> + + <rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" /> + <rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" /> + <rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" /> + <rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" /> + <rule ref="category/java/errorprone.xml/BrokenNullCheck" /> + <rule ref="category/java/errorprone.xml/CheckSkipResult" /> + <rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" /> + <rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" /> + <rule ref="category/java/errorprone.xml/EmptyCatchBlock" /> + <rule ref="category/java/errorprone.xml/JumbledIncrementer" /> + <rule ref="category/java/errorprone.xml/MisplacedNullCheck" /> + <rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" /> + <rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" /> + <rule ref="category/java/errorprone.xml/UnconditionalIfStatement" /> + <rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary" /> + <rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals" /> + <rule ref="category/java/errorprone.xml/UselessOperationOnImmutable" /> + + <rule ref="category/java/multithreading.xml/AvoidThreadGroup" /> + <rule ref="category/java/multithreading.xml/DontCallThreadRun" /> + <rule ref="category/java/multithreading.xml/DoubleCheckedLocking" /> + + <rule ref="category/java/performance.xml/BigIntegerInstantiation" /> + +</ruleset> diff --git a/pom.xml b/pom.xml index 947ecb5..f352d72 100644 --- a/pom.xml +++ b/pom.xml @@ -1,502 +1,524 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>datakaveri.org</groupId> - <artifactId>iudx.gis.interface</artifactId> - <version>0.0.1-SNAPSHOT</version> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>datakaveri.org</groupId> + <artifactId>iudx.gis.interface</artifactId> + <version>0.0.1-SNAPSHOT</version> - <properties> - <vertx.version>4.3.2</vertx.version> - <junit-jupiter-engine.version>5.8.2</junit-jupiter-engine.version> - <hazelcast.version>4.0.2</hazelcast.version> - <micrometer.version>1.9.2</micrometer.version> - <curator.version>5.3.0</curator.version> - <disruptor.version>3.4.4</disruptor.version> - <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version> - <log4j2.version>2.17.1</log4j2.version> - <testcontainer.version>1.17.3</testcontainer.version> - <testcontainer.pg.version>1.17.3</testcontainer.pg.version> - - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <properties> + <vertx.version>4.3.2</vertx.version> + <junit-jupiter-engine.version>5.8.2</junit-jupiter-engine.version> + <hazelcast.version>4.0.2</hazelcast.version> + <micrometer.version>1.9.2</micrometer.version> + <curator.version>5.3.0</curator.version> + <disruptor.version>3.4.4</disruptor.version> + <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version> + <log4j2.version>2.17.1</log4j2.version> + <testcontainer.version>1.17.3</testcontainer.version> + <testcontainer.pg.version>1.17.3</testcontainer.pg.version> - <exec.mainClass>iudx.gis.server.deploy.Deployer</exec.mainClass> - <exec.mainClassDev>iudx.gis.server.deploy.DeployerDev</exec.mainClassDev> - <config-dev.file>config-dev.json</config-dev.file> - </properties> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-stack-depchain</artifactId> - <version>${vertx.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - <!-- log4j2 bom to keep org.apache.logging.log4j artifacts version in - sync --> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-bom</artifactId> - <version>${log4j2.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> + <exec.mainClass>iudx.gis.server.deploy.Deployer</exec.mainClass> + <exec.mainClassDev>iudx.gis.server.deploy.DeployerDev</exec.mainClassDev> + <config-dev.file>config-dev.json</config-dev.file> + </properties> - <dependencies> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-codegen</artifactId> - <classifier>processor</classifier> - </dependency> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-service-proxy</artifactId> - </dependency> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-service-discovery</artifactId> - </dependency> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-auth-jwt</artifactId> - </dependency> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-core</artifactId> - </dependency> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-web</artifactId> - </dependency> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-web-client</artifactId> - </dependency> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-json-schema</artifactId> - </dependency> - <dependency> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <version>3.1.2</version> - </dependency> - <!-- <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> - <version>3.8.1</version> </dependency> --> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-junit5</artifactId> - </dependency> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-pg-client</artifactId> - </dependency> - <!-- log4j2 logging dependencies --> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - </dependency> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-micrometer-metrics</artifactId> - </dependency> - <dependency> - <groupId>io.micrometer</groupId> - <artifactId>micrometer-core</artifactId> - <version>${micrometer.version}</version> - </dependency> - <dependency> - <groupId>io.micrometer</groupId> - <artifactId>micrometer-registry-prometheus</artifactId> - <version>${micrometer.version}</version> - </dependency> - <!--LMAX Disruptor for enabling Asynchronous log4j2 Logging --> - <dependency> - <groupId>com.lmax</groupId> - <artifactId>disruptor</artifactId> - <version>${disruptor.version}</version> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>${junit-jupiter-engine.version}</version> - </dependency> - <dependency> - <groupId>org.junit.vintage</groupId> - <artifactId>junit-vintage-engine</artifactId> - <version>${junit-jupiter-engine.version}</version> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-params</artifactId> - <version>${junit-jupiter-engine.version}</version> - <scope>test</scope> - </dependency> - <!-- Packages for Hazelcast clustering based on Zookeeper discovery --> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-hazelcast</artifactId> - </dependency> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-stack-depchain</artifactId> + <version>${vertx.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <!-- log4j2 bom to keep org.apache.logging.log4j artifacts version in + sync --> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-bom</artifactId> + <version>${log4j2.version}</version> + <scope>import</scope> + <type>pom</type> + </dependency> + </dependencies> + </dependencyManagement> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-rabbitmq-client</artifactId> + <dependencies> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-codegen</artifactId> + <classifier>processor</classifier> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-service-proxy</artifactId> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-service-discovery</artifactId> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-auth-jwt</artifactId> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-core</artifactId> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-web</artifactId> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-web-client</artifactId> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-json-schema</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>3.1.2</version> + </dependency> + <!-- <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> + <version>3.8.1</version> </dependency> --> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-junit5</artifactId> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-pg-client</artifactId> + </dependency> + <!-- log4j2 logging dependencies --> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-micrometer-metrics</artifactId> + </dependency> + <dependency> + <groupId>io.micrometer</groupId> + <artifactId>micrometer-core</artifactId> + <version>${micrometer.version}</version> + </dependency> + <dependency> + <groupId>io.micrometer</groupId> + <artifactId>micrometer-registry-prometheus</artifactId> + <version>${micrometer.version}</version> + </dependency> + <!--LMAX Disruptor for enabling Asynchronous log4j2 Logging --> + <dependency> + <groupId>com.lmax</groupId> + <artifactId>disruptor</artifactId> + <version>${disruptor.version}</version> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>${junit-jupiter-engine.version}</version> + </dependency> + <dependency> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + <version>${junit-jupiter-engine.version}</version> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-params</artifactId> + <version>${junit-jupiter-engine.version}</version> + <scope>test</scope> + </dependency> + <!-- Packages for Hazelcast clustering based on Zookeeper discovery --> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-hazelcast</artifactId> + </dependency> - </dependency> - <dependency> - <groupId>com.hazelcast</groupId> - <artifactId>hazelcast-zookeeper</artifactId> - <version>${hazelcast.version}</version> - </dependency> - <dependency> - <groupId>org.testcontainers</groupId> - <artifactId>testcontainers</artifactId> - <version>${testcontainer.version}</version> - <scope>test</scope> - </dependency> - <!-- for postgres container --> - <dependency> - <groupId>org.testcontainers</groupId> - <artifactId>postgresql</artifactId> - <version>${testcontainer.pg.version}</version> - <scope>test</scope> - </dependency> - <dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-rabbitmq-client</artifactId> + + </dependency> + <dependency> + <groupId>com.hazelcast</groupId> + <artifactId>hazelcast-zookeeper</artifactId> + <version>${hazelcast.version}</version> + </dependency> + <dependency> + <groupId>org.testcontainers</groupId> + <artifactId>testcontainers</artifactId> + <version>${testcontainer.version}</version> + <scope>test</scope> + </dependency> + <!-- for postgres container --> + <dependency> + <groupId>org.testcontainers</groupId> + <artifactId>postgresql</artifactId> + <version>${testcontainer.pg.version}</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>com.ongres.scram</groupId> <artifactId>client</artifactId> <version>2.1</version> </dependency> - <dependency> - <groupId>org.postgresql</groupId> - <artifactId>postgresql</artifactId> - <version>42.4.3</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.testcontainers</groupId> - <artifactId>junit-jupiter</artifactId> - <version>1.17.3</version> - <scope>test</scope> - </dependency> - <!-- Thanks for using https://jar-download.com --> - <!-- --> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>3.11.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-junit-jupiter</artifactId> - <version>3.11.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.curator</groupId> - <artifactId>curator-x-discovery</artifactId> - <version>${curator.version}</version> - </dependency> - <dependency> - <groupId>org.apache.curator</groupId> - <artifactId>curator-x-discovery</artifactId> - <version>${curator.version}</version> - </dependency> - <dependency> - <groupId>io.vertx</groupId> - <artifactId>vertx-web-api-contract</artifactId> - </dependency> - <!-- for validation of coordinates --> - <dependency> - <groupId>org.wololo</groupId> - <artifactId>jts2geojson</artifactId> - <version>0.17.0</version> - </dependency> - <dependency> - <groupId>com.redislabs</groupId> - <artifactId>jrejson</artifactId> - <version>1.5.0</version> - </dependency> + <dependency> + <groupId>org.postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>42.4.3</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testcontainers</groupId> + <artifactId>junit-jupiter</artifactId> + <version>1.17.3</version> + <scope>test</scope> + </dependency> + <!-- Thanks for using https://jar-download.com --> + <!-- --> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>3.11.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-junit-jupiter</artifactId> + <version>3.11.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.curator</groupId> + <artifactId>curator-x-discovery</artifactId> + <version>${curator.version}</version> + </dependency> + <dependency> + <groupId>org.apache.curator</groupId> + <artifactId>curator-x-discovery</artifactId> + <version>${curator.version}</version> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-web-api-contract</artifactId> + </dependency> + <!-- for validation of coordinates --> + <dependency> + <groupId>org.wololo</groupId> + <artifactId>jts2geojson</artifactId> + <version>0.17.0</version> + </dependency> + <dependency> + <groupId>com.redislabs</groupId> + <artifactId>jrejson</artifactId> + <version>1.5.0</version> + </dependency> + + </dependencies> - </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>${jacoco-maven-plugin.version}</version> + <executions> + <execution> + <id>prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>report</id> + <phase>prepare-package</phase> + <goals> + <goal>report</goal> + </goals> + </execution> + <execution> + <id>post-unit-test</id> + <phase>test</phase> + <goals> + <goal>report</goal> + </goals> + <configuration> + <dataFile>target/jacoco.exec</dataFile> + <outputDirectory>target/jacoco-site</outputDirectory> + </configuration> + </execution> + </executions> + <configuration> + <systemPropertyVariables> + <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile> + </systemPropertyVariables> + <excludes> + <!-- classes are excluded since they are not testable or don't add + any value if test cases are written. --> + <!-- ApiServerVerticle testing is covered in integration for now. --> + <exclude>iudx/gis/server/apiserver/*.class</exclude> + <exclude>**/*VertxEBProxy.class</exclude> + <exclude>**/Constants.class</exclude> + <exclude>**/*AuthenticationService.class</exclude> + <exclude>**/*VertxProxyHandler.class</exclude> + <exclude>**/*DataBrokerServiceImpl.class</exclude> + <exclude>**/*PostgresService.class</exclude> + <exclude>**/*DataBrokerService.class</exclude> + <exclude>**/*DatabaseService.class</exclude> + <exclude>iudx/gis/server/apiserver/validation/types/Validator.class</exclude> + <exclude>**/*CacheService.class</exclude> + <exclude>**/*JwtDataConverter.class</exclude> + <exclude>**/*JwtData.class</exclude> + <exclude>**/*MeteringService.class</exclude> + <exclude>**/*Util.class</exclude> + <exclude>**/*Verticle.class</exclude> + <exclude>iudx/gis/server/deploy/*.class</exclude> + </excludes> + </configuration> + </plugin> - <build> - <plugins> - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>${jacoco-maven-plugin.version}</version> - <executions> - <execution> - <id>prepare-agent</id> - <goals> - <goal>prepare-agent</goal> - </goals> - </execution> - <execution> - <id>report</id> - <phase>prepare-package</phase> - <goals> - <goal>report</goal> - </goals> - </execution> - <execution> - <id>post-unit-test</id> - <phase>test</phase> - <goals> - <goal>report</goal> - </goals> - <configuration> - <dataFile>target/jacoco.exec</dataFile> - <outputDirectory>target/jacoco-site</outputDirectory> - </configuration> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile> - </systemPropertyVariables> - <excludes> - <!-- classes are excluded since they are not testable or don't add - any value if test cases are written. --> - <!-- ApiServerVerticle testing is covered in integration for now. --> - <exclude>iudx/gis/server/apiserver/*.class</exclude> - <exclude>**/*VertxEBProxy.class</exclude> - <exclude>**/Constants.class</exclude> - <exclude>**/*AuthenticationService.class</exclude> - <exclude>**/*VertxProxyHandler.class</exclude> - <exclude>**/*DataBrokerServiceImpl.class</exclude> - <exclude>**/*PostgresService.class</exclude> - <exclude>**/*DataBrokerService.class</exclude> - <exclude>**/*DatabaseService.class</exclude> - <exclude>iudx/gis/server/apiserver/validation/types/Validator.class</exclude> - <exclude>**/*CacheService.class</exclude> - <exclude>**/*JwtDataConverter.class</exclude> - <exclude>**/*JwtData.class</exclude> - <exclude>**/*MeteringService.class</exclude> - <exclude>**/*Util.class</exclude> - <exclude>**/*Verticle.class</exclude> - <exclude>iudx/gis/server/deploy/*.class</exclude> - </excludes> - </configuration> - </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>3.1.2</version> + <dependencies> + <dependency> + <groupId>com.puppycrawl.tools</groupId> + <artifactId>checkstyle</artifactId> + <version>10.5.0</version> + </dependency> + </dependencies> + <configuration> + <!-- <violationSeverity>warning</violationSeverity> --> + <consoleOutput>true</consoleOutput> + <encoding>UTF-8</encoding> + <configLocation>./google_checks.xml</configLocation> + <sourceDirectories> + <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> + </sourceDirectories> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <version>3.17.0</version> + <configuration> + <targetJdk>13</targetJdk> + <rulesets> + <ruleset>./iudx-pmd-ruleset.xml</ruleset> + </rulesets> + <printFailingErrors>true</printFailingErrors> + <!--<maxAllowedViolations>622</maxAllowedViolations>--> + <excludeRoots> + <excludeRoot>target/generated-sources</excludeRoot> + </excludeRoots> + </configuration> + </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <version>3.1.2</version> - <dependencies> - <dependency> - <groupId>com.puppycrawl.tools</groupId> - <artifactId>checkstyle</artifactId> - <version>10.3.1</version> - </dependency> - </dependencies> - <configuration> - <!-- <violationSeverity>warning</violationSeverity> --> - <consoleOutput>true</consoleOutput> - <encoding>UTF-8</encoding> - <configLocation>google_checks.xml</configLocation> - <module name="LineLength"> - <property name="max" value="120" /> - </module> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>3.3.0</version> - <executions> - <execution> - <id>dev</id> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <filters> - <filter> - <artifact>*:*</artifact> - <excludes> - <exclude>META-INF/maven/**</exclude> - <exclude>META-INF/*.RSA</exclude> - <exclude>META-INF/*.DSA</exclude> - <exclude>META-INF/*.SF</exclude> - </excludes> - </filter> - </filters> - <transformers> - <transformer - implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> - <manifestEntries> - <Main-Class>${exec.mainClassDev}</Main-Class> - </manifestEntries> - </transformer> - <transformer - implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> - <resource>META-INF/services/io.vertx.core.spi.VerticleFactory - </resource> - <resource>META-INF/services/io.vertx.core.spi.VertxServiceProvider - </resource> - </transformer> - </transformers> - <artifactSet></artifactSet> - <outputFile>${project.build.directory}/${project.artifactId}-dev-${project.version}-fat.jar - </outputFile> - </configuration> - </execution> - <execution> - <id>cluster</id> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <filters> - <filter> - <artifact>*:*</artifact> - <excludes> - <exclude>META-INF/maven/**</exclude> - <exclude>META-INF/*.RSA</exclude> - <exclude>META-INF/*.DSA</exclude> - <exclude>META-INF/*.SF</exclude> - </excludes> - </filter> - </filters> - <transformers> - <transformer - implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> - <manifestEntries> - <Main-Class>${exec.mainClass}</Main-Class> - </manifestEntries> - </transformer> - <transformer - implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> - <resource>META-INF/services/io.vertx.core.spi.VerticleFactory - </resource> - <resource>META-INF/services/io.vertx.core.spi.VertxServiceProvider - </resource> - </transformer> - </transformers> - <artifactSet></artifactSet> - <outputFile>${project.build.directory}/${project.artifactId}-cluster-${project.version}-fat.jar - </outputFile> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>3.4.0</version> - <configuration> - <source>13</source> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <version>3.1.0</version> - <executions> - <execution> - <id>gis-server</id> - <configuration> - <mainClass>iudx.gis.server.deploy.DeployerDev</mainClass> - <arguments> - <argument>-jar</argument> - <argument>{project.build.directory}/${project.artifactId}-dev-${project.version}-fat.jar - </argument> - <argument>-c</argument> - <argument>./configs/config-dev.json</argument> - </arguments> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>3.0.0-M7</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>11</source> - <target>11</target> - <annotationProcessors> - <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor> - </annotationProcessors> - </configuration> - </plugin> - </plugins> - </build> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>3.3.0</version> + <executions> + <execution> + <id>dev</id> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <filters> + <filter> + <artifact>*:*</artifact> + <excludes> + <exclude>META-INF/maven/**</exclude> + <exclude>META-INF/*.RSA</exclude> + <exclude>META-INF/*.DSA</exclude> + <exclude>META-INF/*.SF</exclude> + </excludes> + </filter> + </filters> + <transformers> + <transformer + implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <manifestEntries> + <Main-Class>${exec.mainClassDev}</Main-Class> + </manifestEntries> + </transformer> + <transformer + implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> + <resource>META-INF/services/io.vertx.core.spi.VerticleFactory + </resource> + <resource>META-INF/services/io.vertx.core.spi.VertxServiceProvider + </resource> + </transformer> + </transformers> + <artifactSet></artifactSet> + <outputFile>${project.build.directory}/${project.artifactId}-dev-${project.version}-fat.jar + </outputFile> + </configuration> + </execution> + <execution> + <id>cluster</id> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <filters> + <filter> + <artifact>*:*</artifact> + <excludes> + <exclude>META-INF/maven/**</exclude> + <exclude>META-INF/*.RSA</exclude> + <exclude>META-INF/*.DSA</exclude> + <exclude>META-INF/*.SF</exclude> + </excludes> + </filter> + </filters> + <transformers> + <transformer + implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <manifestEntries> + <Main-Class>${exec.mainClass}</Main-Class> + </manifestEntries> + </transformer> + <transformer + implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> + <resource>META-INF/services/io.vertx.core.spi.VerticleFactory + </resource> + <resource>META-INF/services/io.vertx.core.spi.VertxServiceProvider + </resource> + </transformer> + </transformers> + <artifactSet></artifactSet> + <outputFile> + ${project.build.directory}/${project.artifactId}-cluster-${project.version}-fat.jar + </outputFile> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.4.0</version> + <configuration> + <source>13</source> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>3.1.0</version> + <executions> + <execution> + <id>gis-server</id> + <configuration> + <mainClass>iudx.gis.server.deploy.DeployerDev</mainClass> + <arguments> + <argument>-jar</argument> + <argument>{project.build.directory}/${project.artifactId}-dev-${project.version}-fat.jar + </argument> + <argument>-c</argument> + <argument>./configs/config-dev.json</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M7</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>11</source> + <target>11</target> + <annotationProcessors> + <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor> + </annotationProcessors> + </configuration> + </plugin> + </plugins> + </build> - <reporting> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-pmd-plugin</artifactId> - <version>3.17.0</version> - <configuration> - <targetJdk>13</targetJdk> - <rulesets> - <ruleset>/rulesets/java/braces.xml</ruleset> - <ruleset>/rulesets/java/naming.xml</ruleset> - <ruleset>/rulesets/java/imports.xml</ruleset> - <ruleset>/rulesets/java/unnecessary.xml</ruleset> - <ruleset>/rulesets/java/unusedcode.xml</ruleset> - </rulesets> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <version>3.1.2</version> - <configuration> - <consoleOutput>true</consoleOutput> - <encoding>UTF-8</encoding> - <configLocation>google_checks.xml</configLocation> - <failOnViolation>false</failOnViolation> - </configuration> + <reporting> + <plugins> + <!-- + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <version>3.17.0</version> + <configuration> + <targetJdk>13</targetJdk> + <rulesets> + <ruleset>/rulesets/java/braces.xml</ruleset> + <ruleset>/rulesets/java/naming.xml</ruleset> + <ruleset>/rulesets/java/imports.xml</ruleset> + <ruleset>/rulesets/java/unnecessary.xml</ruleset> + <ruleset>/rulesets/java/unusedcode.xml</ruleset> + </rulesets> + </configuration> + </plugin> + --> + <!-- + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>3.1.2</version> + <configuration> + <consoleOutput>true</consoleOutput> + <encoding>UTF-8</encoding> + <configLocation>google_checks.xml</configLocation> + <failOnViolation>false</failOnViolation> + </configuration> - <reportSets> - <reportSet> - <reports> - <report>checkstyle</report> - </reports> - </reportSet> - </reportSets> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-report-plugin</artifactId> - <version>3.0.0-M7</version> - <reportSets> - <reportSet> - <reports> - <report>report-only</report> - </reports> - </reportSet> - </reportSets> - </plugin> + <reportSets> + <reportSet> + <reports> + <report>checkstyle</report> + </reports> + </reportSet> + </reportSets> + </plugin> + --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-report-plugin</artifactId> + <version>3.0.0-M7</version> + <reportSets> + <reportSet> + <reports> + <report>report-only</report> + </reports> + </reportSet> + </reportSets> + </plugin> - </plugins> - </reporting> + </plugins> + </reporting> </project>