RED-9472: seperation of system rules

fixed checkstyle
This commit is contained in:
yhampe 2024-12-13 15:27:41 +01:00
parent 9cb19fb0f7
commit 88155dc211

View File

@ -75,17 +75,14 @@ public class RuleFileBluePrint {
Set<String> newGlobals = Arrays.stream(other.getGlobals().split("\n"))
.map(String::trim)
.filter(line -> !line.isEmpty())
.map(line -> line.startsWith(GLOBAL_PREFIX) ? line : GLOBAL_PREFIX + line)
.collect(Collectors.toCollection(LinkedHashSet::new));
// Combine globals while maintaining order and format
StringBuilder globalsBuilder = new StringBuilder();
Stream.concat(existingGlobals.stream(), newGlobals.stream())
.distinct()
.forEach(global -> {
if (!global.startsWith(GLOBAL_PREFIX)) {
global = GLOBAL_PREFIX + global;
}
globalsBuilder.append(global).append("\n");
});
.forEach(globalLine -> globalsBuilder.append(globalLine).append("\n"));
this.globals = globalsBuilder.toString().trim();
}