import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.annotation.CheckForNull;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rule.RuleStatus;
}
public Map<String, Long> countAllActiveRules() {
- Set<Map.Entry<String, Long>> entries = activeRuleIndex.countAllByQualityProfileKey().entrySet();
- Map<String, Long> counts = new HashMap<>(entries.size());
- for (Map.Entry<String, Long> entry : entries) {
- counts.put(entry.getKey(), entry.getValue());
- }
- return counts;
+ return activeRuleIndex.countAllByQualityProfileKey();
}
public Map<String, Multimap<String, FacetValue>> getAllProfileStats() {
return Sets.newHashSet(Sets.difference(languageKeys, set2));
}
- private void addAllFromDto(Map<String, QProfile> qualityProfiles, Collection<QualityProfileDto> list) {
+ private static void addAllFromDto(Map<String, QProfile> qualityProfiles, Collection<QualityProfileDto> list) {
for (QualityProfileDto qualityProfileDto : list) {
qualityProfiles.put(qualityProfileDto.getLanguage(), QualityProfileDtoToQProfile.INSTANCE.apply(qualityProfileDto));
}
}
- private void addAll(Map<String, QProfile> qualityProfiles, Collection<QProfile> list) {
+ private static void addAll(Map<String, QProfile> qualityProfiles, Collection<QProfile> list) {
for (QProfile qProfile : list) {
qualityProfiles.put(qProfile.language(), qProfile);
}
return from(Arrays.asList(languages.all())).transform(LanguageToKey.INSTANCE).toSet();
}
- private List<QProfile> findDefaultProfiles(Set<String> languageKeys) {
- try (DbSession dbSession = dbClient.openSession(false)) {
- return findDefaultProfiles(dbSession, languageKeys);
- }
- }
-
private List<QProfile> findDefaultProfiles(final DbSession dbSession, Set<String> languageKeys) {
return from(profileFactory.getDefaults(dbSession, languageKeys))
.transform(QualityProfileDtoToQProfile.INSTANCE)