Skip to content

Commit

Permalink
[MNG-7416] Simplify Boolean expressions and returns (#333)
Browse files Browse the repository at this point in the history
Use this link to re-run the recipe: https://app.moderne.io/recipes/builder/SEvWu02zw?organizationId=QXBhY2hlIE1hdmVu

Co-authored-by: Moderne <team@moderne.io>
  • Loading branch information
timtebeek and TeamModerne committed Sep 26, 2023
1 parent 33d385e commit 20d5424
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,8 @@ private boolean isEnabled(RemoteRepository repository, Metadata.Nature nature) {
&& repository.getPolicy(false).isEnabled()) {
return true;
}
if (!Metadata.Nature.RELEASE.equals(nature)
&& repository.getPolicy(true).isEnabled()) {
return true;
}
return false;
return !Metadata.Nature.RELEASE.equals(nature)
&& repository.getPolicy(true).isEnabled();
}

private RepositoryPolicy getPolicy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ public static boolean equalsId(Artifact artifact1, Artifact artifact2) {
if (!Objects.equals(artifact1.getClassifier(), artifact2.getClassifier())) {
return false;
}
if (!Objects.equals(artifact1.getVersion(), artifact2.getVersion())) {
return false;
}
return true;
return Objects.equals(artifact1.getVersion(), artifact2.getVersion());
}

/**
Expand Down Expand Up @@ -196,10 +193,7 @@ public static boolean equalsBaseId(Artifact artifact1, Artifact artifact2) {
if (!Objects.equals(artifact1.getClassifier(), artifact2.getClassifier())) {
return false;
}
if (!Objects.equals(artifact1.getBaseVersion(), artifact2.getBaseVersion())) {
return false;
}
return true;
return Objects.equals(artifact1.getBaseVersion(), artifact2.getBaseVersion());
}

/**
Expand All @@ -225,9 +219,6 @@ public static boolean equalsVersionlessId(Artifact artifact1, Artifact artifact2
if (!Objects.equals(artifact1.getExtension(), artifact2.getExtension())) {
return false;
}
if (!Objects.equals(artifact1.getClassifier(), artifact2.getClassifier())) {
return false;
}
return true;
return Objects.equals(artifact1.getClassifier(), artifact2.getClassifier());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ public boolean accept(DependencyNode node, List<DependencyNode> parents) {

id = dependency.getArtifact().getGroupId() + ':' + id;

if (excludes.contains(id)) {
return false;
}

return true;
return !(excludes.contains(id));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ private boolean matches(Exclusion exclusion, Artifact artifact) {
if (!matches(exclusion.getExtension(), artifact.getExtension())) {
return false;
}
if (!matches(exclusion.getClassifier(), artifact.getClassifier())) {
return false;
}
return true;
return matches(exclusion.getClassifier(), artifact.getClassifier());
}

private boolean matches(String pattern, String value) {
Expand Down

0 comments on commit 20d5424

Please sign in to comment.