if (!periodsHolder.getPeriods().isEmpty()) {
Double[] unresolvedVariations = new Double[PeriodsHolder.MAX_NUMBER_OF_PERIODS];
for (Period period : periodsHolder.getPeriods()) {
- unresolvedVariations[period.getIndex() - 1] = new Double(currentCounters.counterForPeriod(period.getIndex()).unresolved);
+ unresolvedVariations[period.getIndex() - 1] = (double) currentCounters.counterForPeriod(period.getIndex()).unresolved;
}
measureRepository.add(component, metricRepository.getByKey(NEW_VIOLATIONS_KEY), Measure.newMeasureBuilder()
.setVariations(new MeasureVariations(unresolvedVariations))
return min;
}
- private static CommonRuleIssue generateIssue(Optional<Measure> commentDensityMeasure, Optional<Measure> commentLinesMeasure, Optional<Measure> nclocMeasure, double minCommentDensity) {
+ private static CommonRuleIssue generateIssue(Optional<Measure> commentDensityMeasure, Optional<Measure> commentLinesMeasure,
+ Optional<Measure> nclocMeasure, double minCommentDensity) {
int commentLines = commentLinesMeasure.isPresent() ? commentLinesMeasure.get().getIntValue() : 0;
int ncloc = nclocMeasure.get().getIntValue();
int minExpectedCommentLines = (int) Math.ceil(minCommentDensity * ncloc / (100 - minCommentDensity));
return issues;
}
- private IssueProcessor getIssueProcessor(String sort) {
+ private static IssueProcessor getIssueProcessor(String sort) {
if (IssueQuery.SORT_BY_ASSIGNEE.equals(sort)) {
return new AssigneeSortIssueProcessor();
}
return authorizationDao.selectGlobalPermissions(user).contains(GlobalPermissions.SYSTEM_ADMIN);
}
- private IssueFilterResult createIssueFilterResult(SearchResult<IssueDoc> issues, SearchOptions options) {
+ private static IssueFilterResult createIssueFilterResult(SearchResult<IssueDoc> issues, SearchOptions options) {
Paging paging = Paging.forPageIndex(options.getPage()).withPageSize(options.getLimit()).andTotal((int) issues.getTotal());
return new IssueFilterResult(issues.getDocs(), paging);
}
return stmt;
}
- private void processRow(ResultSet rs, Map<String, Dto> dtosByProjectUuid) throws SQLException {
+ private static void processRow(ResultSet rs, Map<String, Dto> dtosByProjectUuid) throws SQLException {
String projectUuid = rs.getString(1);
String userLogin = rs.getString(2);
String group = rs.getString(3);
.subAggregation(facetTopAggregation);
}
- private Collection<String> escapeValuesForFacetInclusion(@Nullable Collection<String> values) {
+ private static Collection<String> escapeValuesForFacetInclusion(@Nullable Collection<String> values) {
return values == null ? Arrays.<String>asList() : Collections2.transform(values, new Function<String, String>() {
@Override
public String apply(String input) {
}
}
- private void addUserToContextIfSubscribed(Context context, @Nullable String user, Multimap<String, NotificationChannel> subscribedRecipients) {
+ private static void addUserToContextIfSubscribed(Context context, @Nullable String user, Multimap<String, NotificationChannel> subscribedRecipients) {
if (user != null) {
Collection<NotificationChannel> channels = subscribedRecipients.get(user);
for (NotificationChannel channel : channels) {
}
}
- private void notify(String author, Context context, Multimap<String, NotificationChannel> subscribedRecipients) {
+ private static void notify(String author, Context context, Multimap<String, NotificationChannel> subscribedRecipients) {
for (Map.Entry<String, Collection<NotificationChannel>> channelsByRecipients : subscribedRecipients.asMap().entrySet()) {
String login = channelsByRecipients.getKey();
// Do not notify the person that resolved the issue
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
+import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.sonar.api.utils.Duration;
import org.sonar.api.utils.Durations;
import org.sonar.api.utils.Paging;
-import org.sonar.server.issue.workflow.Transition;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.issue.ActionPlanDto;
import org.sonar.db.issue.IssueChangeDto;
import org.sonar.db.user.UserDto;
import org.sonar.markdown.Markdown;
import org.sonar.server.es.Facets;
+import org.sonar.server.issue.workflow.Transition;
import org.sonar.server.ws.WsResponseCommonFormat;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.Issues;
this.languages = languages;
}
- public Issues.SearchWsResponse formatSearch(Set<SearchAdditionalField> fields, SearchResponseData data,
+ public Issues.SearchWsResponse formatSearch(EnumSet<SearchAdditionalField> fields, SearchResponseData data,
Paging paging, @Nullable Facets facets) {
Issues.SearchWsResponse.Builder response = Issues.SearchWsResponse.newBuilder();
response.setPaging(commonFormat.formatPaging(paging));
}
- private List<Issues.Issue> formatIssues(Set<SearchAdditionalField> fields, SearchResponseData data) {
+ private List<Issues.Issue> formatIssues(EnumSet<SearchAdditionalField> fields, SearchResponseData data) {
List<Issues.Issue> result = new ArrayList<>();
Issues.Issue.Builder issueBuilder = Issues.Issue.newBuilder();
for (IssueDto dto : data.getIssues()) {
.setExampleValue("search");
}
- private void handleResponseExample(Action action, Response response) throws IOException {
+ private static void handleResponseExample(Action action, Response response) throws IOException {
if (action.responseExample() != null) {
response
.newJsonWriter()
}
}
- private void writeParam(JsonWriter writer, Param param) {
+ private static void writeParam(JsonWriter writer, Param param) {
writer.beginObject();
writer.prop("key", param.key());
writer.prop("description", param.description());
});
}
- private WidgetPropertyMapper mapper(DbSession session) {
+ private static WidgetPropertyMapper mapper(DbSession session) {
return session.getMapper(WidgetPropertyMapper.class);
}
}
return countGroups(session, query, templateId, null);
}
- private int countGroups(DbSession session, PermissionQuery query, long templateId, @Nullable String groupName) {
+ private static int countGroups(DbSession session, PermissionQuery query, long templateId, @Nullable String groupName) {
Map<String, Object> parameters = groupsParameters(query, templateId);
if (groupName != null) {
parameters.put("groupName", groupName.toUpperCase());
throw new IllegalStateException(String.format("Fail to instantiate class %s for rule %s", checkClassOrInstance, activeRule.ruleKey()), e);
}
- private void configureFields(ActiveRule activeRule, Object check) {
+ private static void configureFields(ActiveRule activeRule, Object check) {
for (Map.Entry<String, String> param : activeRule.params().entrySet()) {
Field field = getField(check, param.getKey());
if (field == null) {
}
}
- private void configureFields(ActiveRule activeRule, Object check) {
+ private static void configureFields(ActiveRule activeRule, Object check) {
for (ActiveRuleParam param : activeRule.getActiveRuleParams()) {
Field field = getField(check, param.getKey());
if (field == null) {
return null;
}
- private Rule toRule(String repositoryKey, Class clazz, org.sonar.check.Rule ruleAnnotation) {
+ private static Rule toRule(String repositoryKey, Class clazz, org.sonar.check.Rule ruleAnnotation) {
String ruleKey = StringUtils.defaultIfEmpty(ruleAnnotation.key(), clazz.getCanonicalName());
String ruleName = StringUtils.defaultIfEmpty(ruleAnnotation.name(), null);
String description = StringUtils.defaultIfEmpty(ruleAnnotation.description(), null);