public Iterable<Duplication> getDuplications(Component file) {
checkFileComponentArgument(file);
- Collection<Duplication> duplications = this.duplications.asMap().get(file.getKey());
- if (duplications == null) {
+ Collection<Duplication> res = this.duplications.asMap().get(file.getKey());
+ if (res == null) {
return Collections.emptyList();
}
- return duplications;
+ return res;
}
@Override
LOGGER.warn("Too many duplication references on file {} for block at line {}. Keeping only the first {} references.",
file.getKey(), originPart.getStartLine(), MAX_CLONE_PART_PER_GROUP);
}
- return counter++ <= MAX_CLONE_GROUP_PER_FILE;
+ boolean res = counter <= MAX_CLONE_GROUP_PER_FILE;
+ counter++;
+ return res;
}
}
}
}
- private void updateTaskResult(CeActivityDto activityDto, @Nullable CeTaskResult taskResult) {
+ private static void updateTaskResult(CeActivityDto activityDto, @Nullable CeTaskResult taskResult) {
if (taskResult != null) {
Long snapshotId = taskResult.getSnapshotId();
if (snapshotId != null) {
try {
int idGenerator = 1;
while (duplications.hasNext()) {
- loadDuplications(file, duplications.next(), idGenerator++);
+ loadDuplications(file, duplications.next(), idGenerator);
+ idGenerator++;
}
} finally {
duplications.close();
if (expectedMessage == null) {
return true;
}
- return EXPECT_NO_MESSAGE_CONSTANT.equals(expectedMessage) ? item.getMessage() == null : item.getMessage().contains(expectedMessage);
+ if (EXPECT_NO_MESSAGE_CONSTANT.equals(expectedMessage)) {
+ return item.getMessage() == null;
+ }
+ return item.getMessage().contains(expectedMessage);
}
@Override