Skip to content

Commit

Permalink
Merge pull request #22907 from mshima/skip_ci-sonar
Browse files Browse the repository at this point in the history
Fix sonar issues.
  • Loading branch information
DanielFran committed Jul 18, 2023
2 parents 637993a + 68a6c64 commit a62032b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 6 additions & 1 deletion generators/common/templates/sonar-project.properties.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
<%_ } _%>
<%_ } _%>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a62032b

Please sign in to comment.