mirror of
https://github.com/SonarSource/sonarqube.git
synced 2024-09-09 22:26:02 +02:00
Fix quality flaws
This commit is contained in:
parent
a47f15d6bd
commit
2b4227eb6e
@ -33,7 +33,6 @@ import org.sonar.process.ProcessProperties;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
// TODO deal with temporary unzipped files
|
||||
@ServerSide
|
||||
public class ReportFiles {
|
||||
|
||||
|
@ -476,7 +476,7 @@ public class IssueIndex extends BaseIndex {
|
||||
.interval(bucketSize)
|
||||
.minDocCount(0L)
|
||||
.format(DateUtils.DATETIME_FORMAT)
|
||||
.preZone(timeZoneString)
|
||||
.timeZone(timeZoneString)
|
||||
.postZone(timeZoneString)
|
||||
.extendedBounds(startTime, endTime);
|
||||
dateHistogram = addDebtAggregationIfNeeded(query, dateHistogram);
|
||||
|
@ -22,7 +22,11 @@ package org.sonar.server.qualityprofile.index;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.elasticsearch.action.support.replication.ReplicationType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.sonar.db.DbSession;
|
||||
import org.sonar.db.qualityprofile.ActiveRuleDto;
|
||||
@ -36,12 +40,6 @@ import org.sonar.server.search.BaseNormalizer;
|
||||
import org.sonar.server.search.IndexField;
|
||||
import org.sonar.server.search.Indexable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class ActiveRuleNormalizer extends BaseNormalizer<ActiveRuleDto, ActiveRuleKey> {
|
||||
|
||||
public static class ActiveRuleField extends Indexable {
|
||||
@ -114,7 +112,6 @@ public class ActiveRuleNormalizer extends BaseNormalizer<ActiveRuleDto, ActiveRu
|
||||
|
||||
/* Creating updateRequest */
|
||||
requests.add(new UpdateRequest()
|
||||
.replicationType(ReplicationType.ASYNC)
|
||||
.routing(key.ruleKey().toString())
|
||||
.id(activeRuleDto.getKey().toString())
|
||||
.parent(activeRuleDto.getKey().ruleKey().toString())
|
||||
@ -136,7 +133,7 @@ public class ActiveRuleNormalizer extends BaseNormalizer<ActiveRuleDto, ActiveRu
|
||||
|
||||
@Override
|
||||
public List<UpdateRequest> normalizeNested(Object object, ActiveRuleKey key) {
|
||||
Preconditions.checkArgument(key != null, "key cannot be null");
|
||||
Preconditions.checkNotNull(key);
|
||||
if (object.getClass().isAssignableFrom(ActiveRuleParamDto.class)) {
|
||||
return nestedUpdate((ActiveRuleParamDto) object, key);
|
||||
} else {
|
||||
@ -146,7 +143,7 @@ public class ActiveRuleNormalizer extends BaseNormalizer<ActiveRuleDto, ActiveRu
|
||||
|
||||
@Override
|
||||
public List<UpdateRequest> deleteNested(Object object, ActiveRuleKey key) {
|
||||
Preconditions.checkArgument(key != null, "key of Rule must be set");
|
||||
Preconditions.checkNotNull(key);
|
||||
if (object.getClass().isAssignableFrom(ActiveRuleParamDto.class)) {
|
||||
return nestedDelete((ActiveRuleParamDto) object, key);
|
||||
} else {
|
||||
@ -154,15 +151,14 @@ public class ActiveRuleNormalizer extends BaseNormalizer<ActiveRuleDto, ActiveRu
|
||||
}
|
||||
}
|
||||
|
||||
private List<UpdateRequest> nestedUpdate(ActiveRuleParamDto param, ActiveRuleKey key) {
|
||||
Preconditions.checkArgument(key != null, "Cannot normalize ActiveRuleParamDto for null key of ActiveRule");
|
||||
private static List<UpdateRequest> nestedUpdate(ActiveRuleParamDto param, ActiveRuleKey key) {
|
||||
Preconditions.checkNotNull(key);
|
||||
|
||||
Map<String, Object> newParam = new HashMap<>();
|
||||
newParam.put(ActiveRuleParamField.NAME.field(), param.getKey());
|
||||
newParam.put(ActiveRuleParamField.VALUE.field(), param.getValue());
|
||||
|
||||
return ImmutableList.of(new UpdateRequest()
|
||||
.replicationType(ReplicationType.ASYNC)
|
||||
.routing(key.ruleKey().toString())
|
||||
.id(key.toString())
|
||||
.script(ProcessProperties.ES_PLUGIN_LISTUPDATE_SCRIPT_NAME)
|
||||
@ -173,9 +169,8 @@ public class ActiveRuleNormalizer extends BaseNormalizer<ActiveRuleDto, ActiveRu
|
||||
);
|
||||
}
|
||||
|
||||
private List<UpdateRequest> nestedDelete(ActiveRuleParamDto param, ActiveRuleKey key) {
|
||||
private static List<UpdateRequest> nestedDelete(ActiveRuleParamDto param, ActiveRuleKey key) {
|
||||
return ImmutableList.of(new UpdateRequest()
|
||||
.replicationType(ReplicationType.ASYNC)
|
||||
.routing(key.ruleKey().toString())
|
||||
.id(key.toString())
|
||||
.script(ProcessProperties.ES_PLUGIN_LISTUPDATE_SCRIPT_NAME)
|
||||
|
@ -162,7 +162,7 @@ public class ResourceIndexDao extends AbstractDao {
|
||||
return indexed;
|
||||
}
|
||||
|
||||
private boolean indexResource(long id, String name, String qualifier, long rootId, SqlSession session, ResourceIndexMapper mapper) {
|
||||
private static boolean indexResource(long id, String name, String qualifier, long rootId, SqlSession session, ResourceIndexMapper mapper) {
|
||||
boolean indexed = false;
|
||||
String key = nameToKey(name);
|
||||
if (key.length() >= MINIMUM_KEY_SIZE || key.length() == SINGLE_INDEX_SIZE) {
|
||||
|
Loading…
Reference in New Issue
Block a user