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

Fixed sonar issues #299

Merged
merged 2 commits into from
Jul 13, 2023
Merged
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 @@ -154,15 +154,16 @@ public AKHQClaimResponseV3 generateClaimV3(@Valid @Body AKHQClaimRequest request
if (bindings.containsKey(key)) {
bindings.get(key).getClusters().add(patternCluster);
} else {
List<String> regexes = new ArrayList<>();
regexes.add(patternRegex);
List<String> clusters = new ArrayList<>();
clusters.add(patternCluster);

// Otherwise we add a new one
bindings.put(key, AKHQClaimResponseV3.Group.builder()
.role(role)
.patterns(new ArrayList<>() {{
add(patternRegex);
}})
.clusters(new ArrayList<>() {{
add(patternCluster);
}})
.patterns(regexes)
.clusters(clusters)
.build());
}
});
Expand Down Expand Up @@ -209,7 +210,7 @@ private List<AKHQClaimResponseV3.Group> optimizeV3Claim(Map<String, AKHQClaimRes
List<String> c = new ArrayList<>(r.clusters);
c.removeAll(value.clusters);
// Same role and same clusters filtering
return r.role.equals(value.role) && c.size() == 0;
return r.role.equals(value.role) && c.isEmpty();
})
.findFirst()
.ifPresentOrElse(
Expand Down