Skip to content

Commit

Permalink
Issue #331 - Cleanup according codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
boretti committed May 31, 2020
1 parent 17df00a commit 59a3cca
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

import java.util.Scanner;

public final class RessourceLoader {
public final class RessourceLoaderHelper {

private RessourceLoader() {
private RessourceLoaderHelper() {
}

public static String loadRessource(Class<?> clazz, String ressource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

import ch.powerunit.extensions.matchers.common.CommonUtils;
import ch.powerunit.extensions.matchers.common.ListJoining;
import ch.powerunit.extensions.matchers.common.RessourceLoader;
import ch.powerunit.extensions.matchers.common.RessourceLoaderHelper;
import ch.powerunit.extensions.matchers.provideprocessor.fields.AbstractFieldDescription;
import ch.powerunit.extensions.matchers.provideprocessor.fields.FieldDescriptionMetaData;
import ch.powerunit.extensions.matchers.provideprocessor.fields.IgnoreFieldDescription;
Expand All @@ -46,16 +46,16 @@
public abstract class ProvidesMatchersAnnotatedElementMatcherMirror
extends ProvidesMatchersAnnotatedElementGeneralMirror {

private static final String INTERFACE_FORMAT = RessourceLoader
private static final String INTERFACE_FORMAT = RessourceLoaderHelper
.loadRessource(ProvidesMatchersAnnotatedElementMatcherMirror.class, "MatchersInterface.txt");

private static final String IMPLEMENTATION_NO_PARENT_FORMAT = RessourceLoader
private static final String IMPLEMENTATION_NO_PARENT_FORMAT = RessourceLoaderHelper
.loadRessource(ProvidesMatchersAnnotatedElementMatcherMirror.class, "MatchersImplementationNoParent.txt");

private static final String IMPLEMENTATION_PARENT_FORMAT = RessourceLoader
private static final String IMPLEMENTATION_PARENT_FORMAT = RessourceLoaderHelper
.loadRessource(ProvidesMatchersAnnotatedElementMatcherMirror.class, "MatchersImplementationParent.txt");

private static final String METADATA_FORMAT = RessourceLoader
private static final String METADATA_FORMAT = RessourceLoaderHelper
.loadRessource(ProvidesMatchersAnnotatedElementMatcherMirror.class, "MatchersMetadata.txt");

private static final ListJoining<AbstractFieldDescription> JOIN_FIELD_DSL_INTERFACE = joinWithMapperAndDelimiter(
Expand Down Expand Up @@ -145,7 +145,7 @@ public List<AbstractFieldDescription> getFields() {
}

public String generateMetadata() {
return String.format(METADATA_FORMAT, getAnnotationProcessorVersion(), getCompatibility(),
return format(METADATA_FORMAT, getAnnotationProcessorVersion(), getCompatibility(),
getFullyQualifiedNameOfClassAnnotatedWithProvideMatcherWithGeneric(),
getFullyQualifiedNameOfClassAnnotated(),
fullyQualifiedNameOfSuperClassOfClassAnnotated.map(CommonUtils::toJavaSyntax).orElse("null"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
import javax.lang.model.element.TypeElement;

import ch.powerunit.extensions.matchers.common.ListJoining;
import ch.powerunit.extensions.matchers.common.RessourceLoader;
import ch.powerunit.extensions.matchers.common.RessourceLoaderHelper;
import ch.powerunit.extensions.matchers.provideprocessor.dsl.DSLMethod;
import ch.powerunit.extensions.matchers.provideprocessor.helper.ProvidesMatchersWithSameValueHelper;

public class ProvidesMatchersAnnotatedElementMirror extends ProvidesMatchersAnnotatedElementMatcherMirror {

private final Collection<Supplier<DSLMethod>> dslProvider;

private static final String MATCHER_FORMAT = RessourceLoader
private static final String MATCHER_FORMAT = RessourceLoaderHelper
.loadRessource(ProvidesMatchersAnnotatedElementMirror.class, "Matchers.txt");

private static final ListJoining<DSLMethod> JOIN_DSL_METHOD = ListJoining
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

import static java.lang.String.format;

import ch.powerunit.extensions.matchers.common.RessourceLoader;
import ch.powerunit.extensions.matchers.common.RessourceLoaderHelper;

public final class FeatureMatcher {

private static final String MATCHER_FORMAT = RessourceLoader.loadRessource(FeatureMatcher.class,
private static final String MATCHER_FORMAT = RessourceLoaderHelper.loadRessource(FeatureMatcher.class,
"FeatureMatcher.txt");

private final String matcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static Stream<String> copyField(AbstractFieldDescription f) {
}

private static DSLMethod generateWithSameValueWithParentMatcherAndNoIgnore(
ProvidesMatchersAnnotatedElementMirror target, boolean hasSuper) {
ProvidesMatchersAnnotatedElementMirror target) {
String genericNoParent = target.getSimpleNameOfGeneratedInterfaceMatcherWithGenericNoParent();
String simpleNameGenericWithParent = target
.getFullyQualifiedNameOfClassAnnotatedWithProvideMatcherWithGeneric();
Expand Down Expand Up @@ -106,17 +106,17 @@ public static Collection<Supplier<DSLMethod>> generateParentValueDSLStarter(
}
}),
() -> target.getParentMirror()
.map(parentMirror -> generateWithSameValueWithParentMatcherAndNoIgnore(target, true))
.map(parentMirror -> generateWithSameValueWithParentMatcherAndNoIgnore(target))
.orElseGet(() -> {
if (isWeakAllowed(target)) {
return generateWithSameValueWithParentMatcherAndNoIgnore(target, true);
return generateWithSameValueWithParentMatcherAndNoIgnore(target);
} else {
return null;
}
}));
}
return asList(() -> generateWithSameValueWithParentMatcherIgnore(target, false),
() -> generateWithSameValueWithParentMatcherAndNoIgnore(target, false));
() -> generateWithSameValueWithParentMatcherAndNoIgnore(target));
}

}

0 comments on commit 59a3cca

Please sign in to comment.