fix quality flaws

This commit is contained in:
Sébastien Lesaint 2015-12-18 10:00:18 +01:00
parent feb13a2e4a
commit daf70b2c4c
5 changed files with 13 additions and 7 deletions

View File

@ -39,11 +39,11 @@ public class DuplicationRepositoryImpl implements DuplicationRepository {
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

View File

@ -173,7 +173,9 @@ public class IntegrateCrossProjectDuplications {
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;
}
}

View File

@ -191,7 +191,7 @@ public class CeQueueImpl implements CeQueue {
}
}
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) {

View File

@ -70,7 +70,8 @@ public class LoadDuplicationsFromReportStep implements ComputationStep {
try {
int idGenerator = 1;
while (duplications.hasNext()) {
loadDuplications(file, duplications.next(), idGenerator++);
loadDuplications(file, duplications.next(), idGenerator);
idGenerator++;
}
} finally {
duplications.close();

View File

@ -70,7 +70,10 @@ public class ExceptionCauseMatcher extends TypeSafeMatcher<Throwable> {
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