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

[MNG-7416] Simplify Boolean expressions and returns #333

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
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
Loading