diff --git a/generators/common/templates/sonar-project.properties.ejs b/generators/common/templates/sonar-project.properties.ejs index 60fb1f9449a6..4483135f57e3 100644 --- a/generators/common/templates/sonar-project.properties.ejs +++ b/generators/common/templates/sonar-project.properties.ejs @@ -39,8 +39,8 @@ sonar.sourceEncoding=UTF-8 sonar.exclusions=<%= clientSrcDir %>content/**/*.*, <%= clientSrcDir %>i18n/*.js, <%= clientDistDir %>**/*.* sonar.issue.ignore.multicriteria=<%_ if (!skipServer) { _%>S3437,<% if (authenticationTypeJwt) { %>S4502,<% } %>S4684,S5145,UndocumentedApi<%_ } _%> - <%_ if (!skipServer) { _%> + # Rule https://rules.sonarsource.com/java/RSPEC-3437 is ignored, as a JPA-managed field cannot be transient sonar.issue.ignore.multicriteria.S3437.resourceKey=<%= MAIN_DIR %>java/**/* sonar.issue.ignore.multicriteria.S3437.ruleKey=squid:S3437 @@ -58,4 +58,9 @@ sonar.issue.ignore.multicriteria.S5145.ruleKey=javasecurity:S5145 # Rule https://rules.sonarsource.com/java/RSPEC-1176 is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names should be self-explanatory sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey=<%= MAIN_DIR %>java/**/* sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey=squid:UndocumentedApi + <%_ if (gatlingTests) { _%> +# Rule https://rules.sonarsource.com/java/RSPEC-2187 is ignored, gatling tests are not supported by sonar +sonar.issue.ignore.multicriteria.S2187.resourceKey=<%= TEST_DIR %>java/gatling/**/* +sonar.issue.ignore.multicriteria.S2187.ruleKey=java:S2187 + <%_ } _%> <%_ } _%> diff --git a/generators/server/templates/src/main/java/package/web/rest/errors/ExceptionTranslator.java.ejs b/generators/server/templates/src/main/java/package/web/rest/errors/ExceptionTranslator.java.ejs index 6ede80387f50..3677ebeaf8e3 100644 --- a/generators/server/templates/src/main/java/package/web/rest/errors/ExceptionTranslator.java.ejs +++ b/generators/server/templates/src/main/java/package/web/rest/errors/ExceptionTranslator.java.ejs @@ -268,16 +268,18 @@ _%> } private String getMappedMessageKey(Throwable err) { - if(err instanceof MethodArgumentNotValidException) + if(err instanceof MethodArgumentNotValidException) { return ErrorConstants.ERR_VALIDATION; <%_ if (!databaseTypeNo && !databaseTypeCassandra) { _%> - else if(err instanceof ConcurrencyFailureException - || err.getCause() != null && err.getCause() instanceof ConcurrencyFailureException) + } else if(err instanceof ConcurrencyFailureException + || err.getCause() != null && err.getCause() instanceof ConcurrencyFailureException) { return ErrorConstants.ERR_CONCURRENCY_FAILURE; <%_ } _%> <%_ if (reactive) { _%> - else if (err instanceof WebExchangeBindException) return ErrorConstants.ERR_VALIDATION; + } else if (err instanceof WebExchangeBindException) { + return ErrorConstants.ERR_VALIDATION; <%_ } _%> + } return null; }