diff --git a/pom.xml b/pom.xml index eeda18d..8fa7187 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ ${project.sonar.root.projectKey} src/main/java src/test/java - https://cookiecode.dev/oss_projects/StyleSniffer + https://stylesniffer.cookiecode.dev/ https://github.com/sebastienvermeille/StyleSniffer diff --git a/stylesniffer-annotation-processor/pom.xml b/stylesniffer-annotation-processor/pom.xml index 2db3f88..a71eb6a 100644 --- a/stylesniffer-annotation-processor/pom.xml +++ b/stylesniffer-annotation-processor/pom.xml @@ -42,6 +42,8 @@ ${java.sdk.version} ${source.encoding} ${basedir}/.. + + ${project.sonar.root.projectKey}-${project.groupId}-${project.artifactId} diff --git a/stylesniffer-annotation-processor/src/main/java/dev/cookiecode/stylesniffer/annotation/processor/RegisterCaseStyleAnnotationProcessor.java b/stylesniffer-annotation-processor/src/main/java/dev/cookiecode/stylesniffer/annotation/processor/RegisterCaseStyleAnnotationProcessor.java index e05b76a..8f2ec46 100644 --- a/stylesniffer-annotation-processor/src/main/java/dev/cookiecode/stylesniffer/annotation/processor/RegisterCaseStyleAnnotationProcessor.java +++ b/stylesniffer-annotation-processor/src/main/java/dev/cookiecode/stylesniffer/annotation/processor/RegisterCaseStyleAnnotationProcessor.java @@ -78,13 +78,13 @@ public class RegisterCaseStyleAnnotationProcessor extends AbstractProcessor { private static final String TEMPLATE_VARIABLE_GENERATED_AT = "generatedAt"; private static final String TEMPLATE_FILE_NAME = "case_style_injector"; private static final String POINT = "."; - private final Class ANNOTATION_CLASS = RegisterCaseStyle.class; - private final Class IMPLEMENTED_INTERFACE_CLASS = CaseStyle.class; + private static final Class ANNOTATION_CLASS = RegisterCaseStyle.class; + private static final Class IMPLEMENTED_INTERFACE_CLASS = CaseStyle.class; @Override public boolean process( final Set annotations, final RoundEnvironment roundEnv) { - final var annotatedElements = roundEnv.getElementsAnnotatedWith(this.ANNOTATION_CLASS); + final var annotatedElements = roundEnv.getElementsAnnotatedWith(ANNOTATION_CLASS); if (!annotatedElements.isEmpty()) { this.generateCaseStyleInjector(annotatedElements); @@ -127,7 +127,7 @@ private Context prepareTemplateContext(final Set elements) { Generated.class.getCanonicalName(), List.class.getCanonicalName(), ArrayList.class.getCanonicalName(), - this.IMPLEMENTED_INTERFACE_CLASS.getCanonicalName()); + IMPLEMENTED_INTERFACE_CLASS.getCanonicalName()); context.setVariable(TEMPLATE_VARIABLE_IMPORTS, imports.stream().sorted().collect(toList())); context.setVariable(TEMPLATE_VARIABLE_CLASS_NAME, GENERATED_CLASS_NAME); diff --git a/stylesniffer-api/pom.xml b/stylesniffer-api/pom.xml index 97530f3..974ecce 100644 --- a/stylesniffer-api/pom.xml +++ b/stylesniffer-api/pom.xml @@ -42,6 +42,8 @@ ${java.sdk.version} ${source.encoding} ${basedir}/.. + + ${project.sonar.root.projectKey}-${project.groupId}-${project.artifactId} @@ -51,4 +53,4 @@ - \ No newline at end of file + diff --git a/stylesniffer-impl/pom.xml b/stylesniffer-impl/pom.xml index 0c8e096..cd3e98d 100644 --- a/stylesniffer-impl/pom.xml +++ b/stylesniffer-impl/pom.xml @@ -42,6 +42,8 @@ ${java.sdk.version} ${source.encoding} ${basedir}/.. + + ${project.sonar.root.projectKey}-${project.groupId}-${project.artifactId} diff --git a/stylesniffer-impl/src/main/java/dev/cookiecode/stylesniffer/impl/SnakeCaseStyle.java b/stylesniffer-impl/src/main/java/dev/cookiecode/stylesniffer/impl/SnakeCaseStyle.java index f7530c8..1fae7cc 100644 --- a/stylesniffer-impl/src/main/java/dev/cookiecode/stylesniffer/impl/SnakeCaseStyle.java +++ b/stylesniffer-impl/src/main/java/dev/cookiecode/stylesniffer/impl/SnakeCaseStyle.java @@ -71,11 +71,7 @@ public Set getVariantNames() { * @param name the name to check * @return {@code true} if the name is in snake_case, {@code false} otherwise */ - private boolean isSnakeCase( - @NonNull - final String - name) { // TODO: consider creating an annotation @NonEmpty to indicate its handled - // upfront + private boolean isSnakeCase(@NonNull final String name) { // Check if the name is all lowercase and contains underscores boolean hasUnderscore = false; for (int i = 0; i < name.length(); i++) { diff --git a/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/KebabCaseStyleTest.java b/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/KebabCaseStyleTest.java index 2885ab2..f5bac9e 100644 --- a/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/KebabCaseStyleTest.java +++ b/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/KebabCaseStyleTest.java @@ -32,6 +32,8 @@ * * @author Sebastien Vermeille */ +@SuppressWarnings( + "java:S2187") // sonar is not able to detect that BaseCaseStyleTest interface generates test class KebabCaseStyleTest implements BaseCaseStyleTest { @Override diff --git a/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/LowerCamelCaseStyleTest.java b/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/LowerCamelCaseStyleTest.java index 6359fec..7c7c444 100644 --- a/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/LowerCamelCaseStyleTest.java +++ b/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/LowerCamelCaseStyleTest.java @@ -32,6 +32,8 @@ * * @author Sebastien Vermeille */ +@SuppressWarnings( + "java:S2187") // sonar is not able to detect that BaseCaseStyleTest interface generates test class LowerCamelCaseStyleTest implements BaseCaseStyleTest { @Override diff --git a/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/PascalCaseStyleTest.java b/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/PascalCaseStyleTest.java index 668c95a..45e17e7 100644 --- a/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/PascalCaseStyleTest.java +++ b/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/PascalCaseStyleTest.java @@ -32,6 +32,8 @@ * * @author Sebastien Vermeille */ +@SuppressWarnings( + "java:S2187") // sonar is not able to detect that BaseCaseStyleTest interface generates test class PascalCaseStyleTest implements BaseCaseStyleTest { @Override diff --git a/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/ScreamingSnakeCaseStyleTest.java b/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/ScreamingSnakeCaseStyleTest.java index 66f0630..1a2953a 100644 --- a/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/ScreamingSnakeCaseStyleTest.java +++ b/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/ScreamingSnakeCaseStyleTest.java @@ -32,6 +32,8 @@ * * @author Sebastien Vermeille */ +@SuppressWarnings( + "java:S2187") // sonar is not able to detect that BaseCaseStyleTest interface generates test class ScreamingSnakeCaseStyleTest implements BaseCaseStyleTest { @Override diff --git a/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/SnakeCaseStyleTest.java b/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/SnakeCaseStyleTest.java index ea1b759..cc34351 100644 --- a/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/SnakeCaseStyleTest.java +++ b/stylesniffer-impl/src/test/java/dev/cookiecode/stylesniffer/impl/SnakeCaseStyleTest.java @@ -30,6 +30,8 @@ * * @author Sebastien Vermeille */ +@SuppressWarnings( + "java:S2187") // sonar is not able to detect that BaseCaseStyleTest interface generates test class SnakeCaseStyleTest implements BaseCaseStyleTest { @Override diff --git a/stylesniffer-testkit/pom.xml b/stylesniffer-testkit/pom.xml index ab8b95d..64a467a 100644 --- a/stylesniffer-testkit/pom.xml +++ b/stylesniffer-testkit/pom.xml @@ -43,6 +43,8 @@ ${java.sdk.version} ${source.encoding} ${basedir}/.. + + ${project.sonar.root.projectKey}-${project.groupId}-${project.artifactId} @@ -63,4 +65,4 @@ - \ No newline at end of file +