Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonar: 31 code smells #11042

Merged
merged 6 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ sonar.test.exclusions=\

sonar.typescript.tsconfigPath=tsconfig.json

sonar.issue.ignore.multicriteria=S1640,S3437,S4502,S4684,S4032,S5778,S1133,S119,UndocumentedApi,S5976,S2068,S117,S5738,S2083,S6206,S6564,S4649
sonar.issue.ignore.multicriteria=S1640,S3437,S4502,S4684,S4032,S5778,S1133,S119,UndocumentedApi,S5976,S2068,S117,S5738,S2083,S6206,S6564,S4649,S7027,S7091

# Rule: Replace map by enum map
sonar.issue.ignore.multicriteria.S1640.resourceKey=src/main/java/**/*
Expand Down Expand Up @@ -104,3 +104,11 @@ sonar.issue.ignore.multicriteria.S6564.ruleKey=typescript:S6564
# Rule: Unexpected missing generic font family for icons font
sonar.issue.ignore.multicriteria.S4649.resourceKey=src/main/webapp/**/*
sonar.issue.ignore.multicriteria.S4649.ruleKey=css:S4649

# Rule: Circular dependencies between classes in the same package should be resolved
sonar.issue.ignore.multicriteria.S7027.resourceKey=src/**/java/**/*
sonar.issue.ignore.multicriteria.S7027.ruleKey=javaarchitecture:S7027

# Rule: Circular dependencies between classes across packages should be resolved
sonar.issue.ignore.multicriteria.S7091.resourceKey=src/**/java/**/*
sonar.issue.ignore.multicriteria.S7091.ruleKey=javaarchitecture:S7091
2 changes: 1 addition & 1 deletion src/main/docker/sonar.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This configuration is intended for development purpose, it's **your** responsibility to harden it for production
services:
sonar:
image: sonarqube:10.6.0-community
image: sonarqube:10.7.0-community
container_name: sonar
platform: linux/x86_64
# Authentication is turned off for out of the box experience while trying out SonarQube
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public void handle(AddJavaBuildProfile command) {
}

private void enablePrecompiledScriptPlugins() {
addFileToProject(from("buildtool/gradle/buildSrc/build.gradle.kts.template"), to("buildSrc/build.gradle.kts"));
addFileToProject(from("buildtool/gradle/buildSrc/build.gradle.kts.template"), to(PLUGIN_BUILD_GRADLE_FILE));
addFileToProject(from("buildtool/gradle/buildSrc/settings.gradle.kts.template"), to("buildSrc/settings.gradle.kts"));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/generator/dependencies/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM sonarqube:10.6.0-community
FROM sonarqube:10.7.0-community
FROM consul:1.15.4
FROM jhipster/consul-config-loader:v0.4.1
FROM jhipster/jhipster-registry:v7.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ sonar.exclusions=\
{{projectBuildDirectory}}/classes/static/**/*.*,\
src/main/webapp/app/index.tsx,\
src/main/webapp/main.ts
sonar.test.exclusions=\
src/test/**/PackageSettings.java

sonar.issue.ignore.multicriteria=S117,S119,S125,S3437,S4502,S4684,S4032,S5778,S1133,S6206,S6437,S6564,UndocumentedApi
sonar.issue.ignore.multicriteria=S117,S119,S125,S3437,S4502,S4684,S4032,S5778,S1133,S6206,S6437,S6564,UndocumentedApi,S2301

# Rule: Local variable and method parameter names should comply with a naming convention
# Handled with checkstyle. Should be revisited with java 25 once Unnamed Patterns and Variables are available (JEP 443)
Expand Down Expand Up @@ -79,3 +81,7 @@ sonar.issue.ignore.multicriteria.S125.ruleKey=xml:S125
# Rule: Remove this redundant type alias and replace its occurrences with "string"
sonar.issue.ignore.multicriteria.S6564.resourceKey=src/main/webapp/**/*
sonar.issue.ignore.multicriteria.S6564.ruleKey=typescript:S6564

# Rule: Methods should not contain selector parameters
sonar.issue.ignore.multicriteria.S2301.resourceKey=src/main/webapp/app/auth/oauth2-auth.service.ts
sonar.issue.ignore.multicriteria.S2301.ruleKey=typescript:S2301
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ sonar.exclusions=\
{{projectBuildDirectory}}/classes/static/**/*.*,\
src/main/webapp/app/index.tsx,\
src/main/webapp/main.ts
sonar.test.exclusions=\
src/test/**/PackageSettings.java

sonar.issue.ignore.multicriteria=S117,S119,S125,S3437,S4502,S4684,S4032,S5778,S1133,S6206,S6548,S6437,S6471,UndocumentedApi
sonar.issue.ignore.multicriteria=S117,S119,S125,S3437,S4502,S4684,S4032,S5778,S1133,S6206,S6548,S6437,S6471,UndocumentedApi,S2301

# Rule: Local variable and method parameter names should comply with a naming convention
# Handled with checkstyle. Should be revisited with java 25 once Unnamed Patterns and Variables are available (JEP 443)
Expand Down Expand Up @@ -79,3 +81,7 @@ sonar.issue.ignore.multicriteria.S6437.ruleKey=java:S6437
# Rule: Run container as default user
sonar.issue.ignore.multicriteria.S6471.resourceKey=src/main/docker/cassandra/**/*
sonar.issue.ignore.multicriteria.S6471.ruleKey=docker:S6471

# Rule: Methods should not contain selector parameters
sonar.issue.ignore.multicriteria.S2301.resourceKey=src/main/webapp/app/auth/oauth2-auth.service.ts
sonar.issue.ignore.multicriteria.S2301.ruleKey=typescript:S2301
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TestRedisManager implements ApplicationListener<ApplicationEnvironmentPrep
return;
}

redisContainer = new GenericContainer(DockerImageName.parse("{{redisDockerImage}}")).withExposedPorts(6379);;
redisContainer = new GenericContainer(DockerImageName.parse("{{redisDockerImage}}")).withExposedPorts(6379);

redisContainer.start();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM {{ cassandraDockerImage }}

# script to orchestrate the automatic keyspace creation and apply all migration scripts
ADD cassandra/scripts/autoMigrate.sh /usr/local/bin/autoMigrate
COPY cassandra/scripts/autoMigrate.sh /usr/local/bin/autoMigrate
RUN chmod 755 /usr/local/bin/autoMigrate

# script to run any cql script from src/main/resources/config/cql
ADD cassandra/scripts/execute-cql.sh /usr/local/bin/execute-cql
COPY cassandra/scripts/execute-cql.sh /usr/local/bin/execute-cql
RUN chmod 755 /usr/local/bin/execute-cql

ENTRYPOINT ["autoMigrate"]
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import java.util.stream.Stream;
class TestCassandraMigrationLoader implements ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered {

private static final Logger log = LoggerFactory.getLogger(TestCassandraMigrationLoader.class);
private static final String cqlDir = "config/cql/changelog/";
private static final String pattern = ".cql";
private static final String CQL_DIR = "config/cql/changelog/";
private static final String PATTERN = ".cql";
private static boolean migrationDone = false;

@Override
Expand All @@ -43,15 +43,15 @@ class TestCassandraMigrationLoader implements ApplicationListener<ApplicationEnv
public void loadMigrationScripts(CqlSession session) {
CQLDataLoader dataLoader = new CQLDataLoader(session);

URL dirUrl = ClassLoader.getSystemResource(cqlDir);
URL dirUrl = ClassLoader.getSystemResource(CQL_DIR);
if (dirUrl == null) { // protect for empty directory
return;
}

try (Stream<Path> stream = Files.list(Paths.get(dirUrl.toURI()))){
stream
.map(Path::toString)
.filter(file -> file.endsWith(pattern))
.filter(file -> file.endsWith(PATTERN))
.sorted()
.map(file -> new FileCQLDataSet(file, false, false))
.forEach(dataLoader::load);
Expand Down
Loading