mirror of
https://github.com/SonarSource/sonarqube.git
synced 2024-08-12 02:10:16 +02:00
fix quality flaws
This commit is contained in:
parent
feb13a2e4a
commit
daf70b2c4c
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user