package org.sonar.xoo.lang;
import com.google.common.base.Splitter;
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.utils.log.Loggers;
import org.sonar.xoo.Xoo;
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
/**
* Parse files *.xoo.symbol
*/
}
}
- private void processLine(File symbolFile, int lineNumber, Symbolizable.SymbolTableBuilder symbolTableBuilder, String line) {
+ private static void processLine(File symbolFile, int lineNumber, Symbolizable.SymbolTableBuilder symbolTableBuilder, String line) {
try {
Iterator<String> split = Splitter.on(",").split(line).iterator();
int startOffset = Integer.parseInt(split.next());
package org.sonar.xoo.lang;
import com.google.common.base.Splitter;
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.utils.log.Loggers;
import org.sonar.xoo.Xoo;
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
/**
* Parse files *.xoo.highlighting
*/
}
}
- private void processLine(File highlightingFile, int lineNumber, NewHighlighting highlightingBuilder, String line) {
+ private static void processLine(File highlightingFile, int lineNumber, NewHighlighting highlightingBuilder, String line) {
try {
Iterator<String> split = Splitter.on(":").split(line).iterator();
int startOffset = Integer.parseInt(split.next());
}
}
- private void createIssues(InputFile file, SensorContext context) {
+ private static void createIssues(InputFile file, SensorContext context) {
ActiveRule rule = context.activeRules().findByInternalKey(XooRulesDefinition.XOO_REPOSITORY,
context.settings().getString(INTERNAL_KEY_PROPERTY));
if (rule != null) {
}
}
- private void createIssues(InputFile file, SensorContext context) {
+ private static void createIssues(InputFile file, SensorContext context) {
Pattern startPattern = Pattern.compile(START_ISSUE_PATTERN);
Pattern endPattern = Pattern.compile(END_ISSUE_PATTERN);
Map<Integer, Map<Integer, TextPointer>> startPositions = new HashMap<>();
Map<Integer, Map<Integer, TextPointer>> endPositions = new HashMap<>();
RuleKey ruleKey = RuleKey.of(XooRulesDefinition.XOO_REPOSITORY, RULE_KEY);
+ parse(file, context, startPattern, endPattern, startPositions, endPositions);
+ createIssues(file, context, startPositions, endPositions, ruleKey);
+ }
+
+ private static void createIssues(InputFile file, SensorContext context, Map<Integer, Map<Integer, TextPointer>> startPositions,
+ Map<Integer, Map<Integer, TextPointer>> endPositions,
+ RuleKey ruleKey) {
+ for (Map.Entry<Integer, Map<Integer, TextPointer>> entry : startPositions.entrySet()) {
+ NewIssue newIssue = context.newIssue().forRule(ruleKey);
+ for (Map.Entry<Integer, TextPointer> location : entry.getValue().entrySet()) {
+ NewIssueLocation newLocation = newIssue.newLocation()
+ .on(file)
+ .at(file.newRange(location.getValue(), endPositions.get(entry.getKey()).get(location.getKey())));
+ if (location.getKey() == 1) {
+ newIssue.at(newLocation.message("Primary location"));
+ } else {
+ newIssue.addLocation(newLocation.message("Location #" + location.getKey()));
+ }
+ }
+ newIssue.save();
+ }
+ }
+
+ private static void parse(InputFile file, SensorContext context, Pattern startPattern, Pattern endPattern, Map<Integer, Map<Integer, TextPointer>> startPositions,
+ Map<Integer, Map<Integer, TextPointer>> endPositions) {
int currentLine = 0;
try {
for (String lineStr : Files.readAllLines(file.path(), context.fileSystem().encoding())) {
} catch (IOException e) {
throw new IllegalStateException("Unable to read file", e);
}
- for (Map.Entry<Integer, Map<Integer, TextPointer>> entry : startPositions.entrySet()) {
- NewIssue newIssue = context.newIssue().forRule(ruleKey);
- for (Map.Entry<Integer, TextPointer> location : entry.getValue().entrySet()) {
- NewIssueLocation newLocation = newIssue.newLocation()
- .on(file)
- .at(file.newRange(location.getValue(), endPositions.get(entry.getKey()).get(location.getKey())));
- if (location.getKey() == 1) {
- newIssue.at(newLocation.message("Primary location"));
- } else {
- newIssue.addLocation(newLocation.message("Location #" + location.getKey()));
- }
- }
- newIssue.save();
- }
}
}
}
}
- private void createIssues(InputFile file, SensorContext context) {
+ private static void createIssues(InputFile file, SensorContext context) {
RuleKey ruleKey = RuleKey.of(XooRulesDefinition.XOO_REPOSITORY, RULE_KEY);
InputDir inputDir = context.fileSystem().inputDir(file.file().getParentFile());
if (inputDir != null) {
}
}
- private void createIssues(InputFile file, SensorContext context) {
+ private static void createIssues(InputFile file, SensorContext context) {
RuleKey ruleKey = RuleKey.of(XooRulesDefinition.XOO_REPOSITORY, RULE_KEY);
NewIssue newIssue = context.newIssue();
newIssue
Map<String, String> keysByUUid = keysByUUid(session, component);
BatchInput.ServerIssue.Builder issueBuilder = BatchInput.ServerIssue.newBuilder();
- for (Iterator<IssueDoc> issueDocIterator = issueIndex.selectIssuesForBatch(component); issueDocIterator.hasNext(); ) {
+ for (Iterator<IssueDoc> issueDocIterator = issueIndex.selectIssuesForBatch(component); issueDocIterator.hasNext();) {
handleIssue(issueDocIterator.next(), issueBuilder, keysByUUid, response.stream().output());
}
} finally {
}
}
- private void handleIssue(IssueDoc issue, BatchInput.ServerIssue.Builder issueBuilder, Map<String, String> keysByUUid, OutputStream out) {
+ private static void handleIssue(IssueDoc issue, BatchInput.ServerIssue.Builder issueBuilder, Map<String, String> keysByUUid, OutputStream out) {
issueBuilder.setKey(issue.key());
issueBuilder.setModuleKey(keysByUUid.get(issue.moduleUuid()));
String path = issue.filePath();
private final UserSession userSession;
public ProjectRepositoryLoader(DbClient dbClient, QProfileFactory qProfileFactory, QProfileLoader qProfileLoader, RuleService ruleService,
- Languages languages, UserSession userSession) {
+ Languages languages, UserSession userSession) {
this.dbClient = dbClient;
this.qProfileFactory = qProfileFactory;
this.qProfileLoader = qProfileLoader;
TreeModuleSettings treeModuleSettings = new TreeModuleSettings(moduleUuidsByKey, moduleIdsByKey, modulesTree, modulesTreeSettings, module);
addSettingsToChildrenModules(ref, query.getModuleKey(), Maps.<String, String>newHashMap(), treeModuleSettings, hasScanPerm, session);
- List<FilePathWithHashDto> files = module.isRootProject() ?
- dbClient.componentDao().selectEnabledFilesFromProject(session, module.uuid()) :
- dbClient.componentDao().selectEnabledDescendantFiles(session, module.uuid());
+ List<FilePathWithHashDto> files = module.isRootProject() ? dbClient.componentDao().selectEnabledFilesFromProject(session, module.uuid())
+ : dbClient.componentDao().selectEnabledDescendantFiles(session, module.uuid());
addFileData(session, ref, modulesTree, files);
// FIXME need real value but actually only used to know if there is a previous analysis in local issue tracking mode so any value is
}
private void addSettingsToChildrenModules(ProjectRepositories ref, String moduleKey, Map<String, String> parentProperties, TreeModuleSettings treeModuleSettings,
- boolean hasScanPerm, DbSession session) {
+ boolean hasScanPerm, DbSession session) {
Map<String, String> currentParentProperties = newHashMap();
currentParentProperties.putAll(parentProperties);
currentParentProperties.putAll(getPropertiesMap(treeModuleSettings.findModuleSettings(moduleKey), hasScanPerm));
}
}
- private void addSettings(ProjectRepositories ref, String module, Map<String, String> properties) {
+ private static void addSettings(ProjectRepositories ref, String module, Map<String, String> properties) {
if (!properties.isEmpty()) {
ref.addSettings(module, properties);
}
// Load all rules of the profile language (only needed fields are loaded)
Map<RuleKey, Rule> languageRules = ruleByRuleKey(ruleService.search(new RuleQuery().setLanguages(newArrayList(qProfile.language())),
new QueryContext(userSession).setLimit(100).setFieldsToReturn(newArrayList(
- RuleNormalizer.RuleField.KEY.field(), RuleNormalizer.RuleField.NAME.field(), RuleNormalizer.RuleField.INTERNAL_KEY.field(), RuleNormalizer.RuleField.TEMPLATE_KEY.field()
- )).setScroll(true))
+ RuleNormalizer.RuleField.KEY.field(), RuleNormalizer.RuleField.NAME.field(), RuleNormalizer.RuleField.INTERNAL_KEY.field(),
+ RuleNormalizer.RuleField.TEMPLATE_KEY.field())).setScroll(true))
.scroll());
- for (Iterator<ActiveRule> activeRuleIterator = qProfileLoader.findActiveRulesByProfile(qProfile.key()); activeRuleIterator.hasNext(); ) {
+ for (Iterator<ActiveRule> activeRuleIterator = qProfileLoader.findActiveRulesByProfile(qProfile.key()); activeRuleIterator.hasNext();) {
ActiveRule activeRule = activeRuleIterator.next();
Rule rule = languageRules.get(activeRule.key().ruleKey());
if (rule == null) {
private Multimap<String, ComponentDto> moduleChildrenByModuleUuid;
private TreeModuleSettings(Map<String, String> moduleUuidsByKey, Map<String, Long> moduleIdsByKey, List<ComponentDto> moduleChildren,
- List<PropertyDto> moduleChildrenSettings, ComponentDto module) {
+ List<PropertyDto> moduleChildrenSettings, ComponentDto module) {
this.moduleIdsByKey = moduleIdsByKey;
this.moduleUuidsByKey = moduleUuidsByKey;
propertiesByModuleId = ArrayListMultimap.create();
import org.sonar.api.rule.Severity;
import org.sonar.api.utils.DateUtils;
import org.sonar.api.utils.System2;
-import org.sonar.db.component.ComponentDto;
import org.sonar.core.util.NonNullInputFunction;
+import org.sonar.db.component.ComponentDto;
import org.sonar.server.es.BaseIndex;
import org.sonar.server.es.EsClient;
import org.sonar.server.es.EsUtils;
*/
public class IssueIndex extends BaseIndex {
-
private static final String SUBSTRING_MATCH_REGEXP = ".*%s.*";
public static final List<String> SUPPORTED_FACETS = ImmutableList.of(
return String.format("%s%s%s", IssueIndexDefinition.TYPE_ISSUE, viewUuid, ViewIndexDefinition.TYPE_VIEW);
}
- private FilterBuilder createAuthorizationFilter(boolean checkAuthorization, @Nullable String userLogin, Set<String> userGroups) {
+ private static FilterBuilder createAuthorizationFilter(boolean checkAuthorization, @Nullable String userLogin, Set<String> userGroups) {
if (checkAuthorization) {
OrFilterBuilder groupsAndUser = FilterBuilders.orFilter();
if (userLogin != null) {
QueryBuilders.matchAllQuery(),
FilterBuilders.boolFilter()
.must(groupsAndUser)
- .cache(true))
- );
+ .cache(true)));
} else {
return FilterBuilders.matchAllFilter();
}
facetTopAggregation.subAggregation(
addDebtAggregationIfNeeded(query, AggregationBuilders
.missing(facetName + FACET_SUFFIX_MISSING)
- .field(fieldName))
- );
+ .field(fieldName)));
return AggregationBuilders
.global(facetName)
private 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) {
- return Pattern.quote(input);
- }
- });
+ @Override
+ public String apply(String input) {
+ return Pattern.quote(input);
+ }
+ });
}
private void addAssignedToMeFacetIfNeeded(SearchRequestBuilder builder, SearchOptions options, IssueQuery query, Map<String, FilterBuilder> filters, QueryBuilder queryBuilder) {
facetTopAggregation.subAggregation(
addDebtAggregationIfNeeded(query, AggregationBuilders
.missing(facetName + FACET_SUFFIX_MISSING)
- .field(fieldName))
- );
+ .field(fieldName)));
return AggregationBuilders
.global(facetName)
facetTopAggregation.subAggregation(
addDebtAggregationIfNeeded(query, AggregationBuilders
.missing(facetName + FACET_SUFFIX_MISSING)
- .field(fieldName))
- );
+ .field(fieldName)));
return AggregationBuilders
.global(facetName)
FilterBuilder dateFilter = FilterBuilders.rangeFilter(IssueIndexDefinition.FIELD_ISSUE_FUNC_CLOSED_AT).lt(beforeDate.getTime());
QueryBuilder queryBuilder = QueryBuilders.filteredQuery(
QueryBuilders.matchAllQuery(),
- FilterBuilders.andFilter(projectFilter, dateFilter)
- );
+ FilterBuilders.andFilter(projectFilter, dateFilter));
getClient().prepareDeleteByQuery(IssueIndexDefinition.INDEX).setQuery(queryBuilder).get();
}
package org.sonar.server.permission;
import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.server.ServerSide;
import org.sonar.core.permission.GlobalPermissions;
-import org.sonar.db.permission.PermissionTemplateDao;
-import org.sonar.db.permission.PermissionTemplateDto;
import org.sonar.db.DbSession;
import org.sonar.db.MyBatis;
+import org.sonar.db.permission.PermissionTemplateDao;
+import org.sonar.db.permission.PermissionTemplateDto;
import org.sonar.db.user.GroupDto;
import org.sonar.db.user.UserDao;
import org.sonar.server.exceptions.BadRequestException;
import org.sonar.server.exceptions.NotFoundException;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
import org.sonar.server.user.UserSession;
/**
}
}
- private void validateKeyPattern(@Nullable String keyPattern) {
+ private static void validateKeyPattern(@Nullable String keyPattern) {
if (StringUtils.isEmpty(keyPattern)) {
return;
}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.batch;
-
-import org.sonar.api.config.Settings;
-import org.sonar.api.profiles.RulesProfile;
-
-/**
- * This interface is implemented by the views plugin!!
- *
- * @deprecated in 4.2
- */
-@Deprecated
-public interface ProfileLoader {
-
- /**
- * Loads quality profile for specified project.
- */
- RulesProfile load(Settings settings);
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.batch.index;
-
-import java.io.Serializable;
-
-public interface Data extends Serializable {
-
- String writeString();
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.batch.index;
-
-import org.sonar.api.resources.Resource;
-import org.sonar.api.utils.SonarException;
-
-/**
- * @since 2.6
- */
-public final class ResourceNotPersistedException extends SonarException {
-
- public ResourceNotPersistedException(Resource resource) {
- super(resource.toString());
- }
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.batch.index;
-
-public class StringData implements Data {
- private String data = null;
-
- public StringData() {
- }
-
- public StringData(String s) {
- this.data = s;
- }
-
- public String data() {
- return data;
- }
-
- @Override
- public String writeString() {
- return data;
- }
-}
package org.sonar.batch.issue;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Override
public List<IssueComment> comments() {
- return null;
+ return Collections.emptyList();
}
@Override
@Override
public Collection<String> tags() {
- return null;
+ return Collections.emptyList();
}
}
@BatchSide
public class IssueFilters {
- private final org.sonar.api.issue.IssueFilter[] exclusionFilters;
- private final IssueFilter[] filters;
- private final Project project;
+ private static final class IssueAdapterForFilter implements Issue {
+ private final Project project;
+ private final org.sonar.batch.protocol.output.BatchReport.Issue rawIssue;
+ private final String componentKey;
+
+ private IssueAdapterForFilter(Project project, org.sonar.batch.protocol.output.BatchReport.Issue rawIssue, String componentKey) {
+ this.project = project;
+ this.rawIssue = rawIssue;
+ this.componentKey = componentKey;
+ }
- public IssueFilters(Project project, org.sonar.api.issue.IssueFilter[] exclusionFilters, IssueFilter[] filters) {
- this.project = project;
- this.exclusionFilters = exclusionFilters;
- this.filters = filters;
- }
+ @Override
+ public String key() {
+ throw unsupported();
+ }
- public IssueFilters(Project project, org.sonar.api.issue.IssueFilter[] exclusionFilters) {
- this(project, exclusionFilters, new IssueFilter[0]);
- }
+ @Override
+ public String componentKey() {
+ return componentKey;
+ }
- public IssueFilters(Project project, IssueFilter[] filters) {
- this(project, new org.sonar.api.issue.IssueFilter[0], filters);
- }
+ @Override
+ public RuleKey ruleKey() {
+ return RuleKey.of(rawIssue.getRuleRepository(), rawIssue.getRuleKey());
+ }
- public IssueFilters(Project project) {
- this(project, new org.sonar.api.issue.IssueFilter[0], new IssueFilter[0]);
- }
+ @Override
+ public String language() {
+ throw unsupported();
+ }
- public boolean accept(String componentKey, BatchReport.Issue rawIssue) {
- Issue issue = toIssueForIssueFilter(componentKey, rawIssue);
- if (new DefaultIssueFilterChain(filters).accept(issue)) {
- // Apply deprecated rules only if filter chain accepts the current issue
- for (org.sonar.api.issue.IssueFilter filter : exclusionFilters) {
- if (!filter.accept(issue)) {
- return false;
- }
- }
- return true;
- } else {
- return false;
+ @Override
+ public String severity() {
+ return rawIssue.getSeverity().name();
}
- }
- private Issue toIssueForIssueFilter(final String componentKey, final BatchReport.Issue rawIssue) {
- return new Issue() {
+ @Override
+ public String message() {
+ return rawIssue.getMsg();
+ }
- @Override
- public String key() {
- throw unsupported();
- }
+ @Override
+ public Integer line() {
+ return rawIssue.hasLine() ? rawIssue.getLine() : null;
+ }
- @Override
- public String componentKey() {
- return componentKey;
- }
+ @Override
+ public Double effortToFix() {
+ return rawIssue.hasEffortToFix() ? rawIssue.getEffortToFix() : null;
+ }
- @Override
- public RuleKey ruleKey() {
- return RuleKey.of(rawIssue.getRuleRepository(), rawIssue.getRuleKey());
- }
+ @Override
+ public String status() {
+ return Issue.STATUS_OPEN;
+ }
- @Override
- public String language() {
- throw unsupported();
- }
+ @Override
+ public String resolution() {
+ return null;
+ }
- @Override
- public String severity() {
- return rawIssue.getSeverity().name();
- }
+ @Override
+ public String reporter() {
+ throw unsupported();
+ }
- @Override
- public String message() {
- return rawIssue.getMsg();
- }
+ @Override
+ public String assignee() {
+ return null;
+ }
- @Override
- public Integer line() {
- return rawIssue.hasLine() ? rawIssue.getLine() : null;
- }
+ @Override
+ public Date creationDate() {
+ return project.getAnalysisDate();
+ }
- @Override
- public Double effortToFix() {
- return rawIssue.hasEffortToFix() ? rawIssue.getEffortToFix() : null;
- }
+ @Override
+ public Date updateDate() {
+ return null;
+ }
- @Override
- public String status() {
- return Issue.STATUS_OPEN;
- }
+ @Override
+ public Date closeDate() {
+ return null;
+ }
- @Override
- public String resolution() {
- return null;
- }
+ @Override
+ public String attribute(String key) {
+ return attributes().get(key);
+ }
- @Override
- public String reporter() {
- throw unsupported();
- }
+ @Override
+ public Map<String, String> attributes() {
+ return rawIssue.hasAttributes() ? KeyValueFormat.parse(rawIssue.getAttributes()) : Collections.<String, String>emptyMap();
+ }
- @Override
- public String assignee() {
- return null;
- }
+ @Override
+ public String authorLogin() {
+ throw unsupported();
+ }
- @Override
- public Date creationDate() {
- return project.getAnalysisDate();
- }
+ @Override
+ public String actionPlanKey() {
+ throw unsupported();
+ }
- @Override
- public Date updateDate() {
- return null;
- }
+ @Override
+ public List<IssueComment> comments() {
+ throw unsupported();
+ }
- @Override
- public Date closeDate() {
- return null;
- }
+ @Override
+ public boolean isNew() {
+ throw unsupported();
+ }
- @Override
- public String attribute(String key) {
- return attributes().get(key);
- }
+ @Override
+ public Duration debt() {
+ throw unsupported();
+ }
- @Override
- public Map<String, String> attributes() {
- return rawIssue.hasAttributes() ? KeyValueFormat.parse(rawIssue.getAttributes()) : Collections.<String, String>emptyMap();
- }
+ @Override
+ public String projectKey() {
+ return project.getEffectiveKey();
+ }
- @Override
- public String authorLogin() {
- throw unsupported();
- }
+ @Override
+ public String projectUuid() {
+ throw unsupported();
+ }
- @Override
- public String actionPlanKey() {
- throw unsupported();
- }
+ @Override
+ public String componentUuid() {
+ throw unsupported();
+ }
- @Override
- public List<IssueComment> comments() {
- throw unsupported();
- }
+ @Override
+ public Collection<String> tags() {
+ throw unsupported();
+ }
- @Override
- public boolean isNew() {
- throw unsupported();
- }
+ private static UnsupportedOperationException unsupported() {
+ return new UnsupportedOperationException("Not available for issues filters");
+ }
+ }
- @Override
- public Duration debt() {
- throw unsupported();
- }
+ private final org.sonar.api.issue.IssueFilter[] exclusionFilters;
+ private final IssueFilter[] filters;
+ private final Project project;
- @Override
- public String projectKey() {
- return project.getEffectiveKey();
- }
+ public IssueFilters(Project project, org.sonar.api.issue.IssueFilter[] exclusionFilters, IssueFilter[] filters) {
+ this.project = project;
+ this.exclusionFilters = exclusionFilters;
+ this.filters = filters;
+ }
- @Override
- public String projectUuid() {
- throw unsupported();
- }
+ public IssueFilters(Project project, org.sonar.api.issue.IssueFilter[] exclusionFilters) {
+ this(project, exclusionFilters, new IssueFilter[0]);
+ }
- @Override
- public String componentUuid() {
- throw unsupported();
- }
+ public IssueFilters(Project project, IssueFilter[] filters) {
+ this(project, new org.sonar.api.issue.IssueFilter[0], filters);
+ }
- @Override
- public Collection<String> tags() {
- throw unsupported();
- }
+ public IssueFilters(Project project) {
+ this(project, new org.sonar.api.issue.IssueFilter[0], new IssueFilter[0]);
+ }
- private UnsupportedOperationException unsupported() {
- return new UnsupportedOperationException("Not available for issues filters");
+ public boolean accept(String componentKey, BatchReport.Issue rawIssue) {
+ Issue issue = new IssueAdapterForFilter(project, rawIssue, componentKey);
+ if (new DefaultIssueFilterChain(filters).accept(issue)) {
+ // Apply deprecated rules only if filter chain accepts the current issue
+ for (org.sonar.api.issue.IssueFilter filter : exclusionFilters) {
+ if (!filter.accept(issue)) {
+ return false;
+ }
}
-
- };
-
+ return true;
+ } else {
+ return false;
+ }
}
}
package org.sonar.batch.issue;
import com.google.common.base.Strings;
+import org.sonar.api.batch.fs.InputComponent;
import org.sonar.api.batch.fs.TextRange;
-import org.sonar.api.batch.fs.internal.DefaultInputComponent;
import org.sonar.api.batch.rule.ActiveRule;
import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.batch.rule.Rule;
}
public boolean initAndAddIssue(Issue issue) {
- String key = ((DefaultInputComponent) issue.primaryLocation().inputComponent()).key();
- BatchComponent component = componentCache.get(key);
+ InputComponent inputComponent = issue.primaryLocation().inputComponent();
+ BatchComponent component = componentCache.get(inputComponent);
Rule rule = validateRule(issue);
ActiveRule activeRule = activeRules.find(issue.ruleKey());
applyExecutionFlows(issue);
BatchReport.Issue rawIssue = builder.build();
- if (filters.accept(key, rawIssue)) {
+ if (filters.accept(inputComponent.key(), rawIssue)) {
write(component, rawIssue);
return true;
}
private void applyAdditionalLocations(Issue issue) {
for (org.sonar.api.batch.sensor.issue.IssueLocation additionalLocation : issue.locations()) {
locationBuilder.clear();
- String locationComponentKey = ((DefaultInputComponent) additionalLocation.inputComponent()).key();
- locationBuilder.setComponentRef(componentCache.get(locationComponentKey).batchId());
+ locationBuilder.setComponentRef(componentCache.get(additionalLocation.inputComponent()).batchId());
String message = additionalLocation.message();
if (message != null) {
locationBuilder.setMsg(message);
flowBuilder.clear();
for (org.sonar.api.batch.sensor.issue.IssueLocation location : executionFlow.locations()) {
locationBuilder.clear();
- String locationComponentKey = ((DefaultInputComponent) location.inputComponent()).key();
- locationBuilder.setComponentRef(componentCache.get(locationComponentKey).batchId());
+ locationBuilder.setComponentRef(componentCache.get(location.inputComponent()).batchId());
String message = location.message();
if (message != null) {
locationBuilder.setMsg(message);
return rawIssuesByLines;
}
- private Multimap<Integer, ServerIssue> lastIssuesByLines(Collection<ServerIssue> previousIssues, IssueTrackingBlocksRecognizer rec) {
+ private static Multimap<Integer, ServerIssue> lastIssuesByLines(Collection<ServerIssue> previousIssues, IssueTrackingBlocksRecognizer rec) {
Multimap<Integer, ServerIssue> previousIssuesByLines = LinkedHashMultimap.create();
for (ServerIssue previousIssue : previousIssues) {
if (rec.isValidLineInReference(previousIssue.line())) {
}
@CheckForNull
- private Integer line(BatchReport.Issue rawIssue) {
+ private static Integer line(BatchReport.Issue rawIssue) {
return rawIssue.hasLine() ? rawIssue.getLine() : null;
}
- private boolean isNotAlreadyMapped(ServerIssue previousIssue, IssueTrackingResult result) {
+ private static boolean isNotAlreadyMapped(ServerIssue previousIssue, IssueTrackingResult result) {
return result.unmatched().contains(previousIssue);
}
- private boolean isNotAlreadyMapped(BatchReport.Issue rawIssue, IssueTrackingResult result) {
+ private static boolean isNotAlreadyMapped(BatchReport.Issue rawIssue, IssueTrackingResult result) {
return !result.isMatched(rawIssue);
}
}
@CheckForNull
- private String message(BatchReport.Issue rawIssue) {
+ private static String message(BatchReport.Issue rawIssue) {
return rawIssue.hasMsg() ? rawIssue.getMsg() : null;
}
- private void mapIssue(BatchReport.Issue rawIssue, @Nullable ServerIssue ref, IssueTrackingResult result) {
+ private static void mapIssue(BatchReport.Issue rawIssue, @Nullable ServerIssue ref, IssueTrackingResult result) {
if (ref != null) {
result.setMatch(rawIssue, ref);
}
unmatchedForRuleAndLine.put(checksumNotNull, i);
}
- private Integer lineNotNull(ServerIssue i) {
+ private static Integer lineNotNull(ServerIssue i) {
Integer line = i.line();
return line != null ? line : 0;
}
import java.util.List;
import java.util.Set;
import javax.annotation.CheckForNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.rule.ActiveRule;
@BatchSide
public class LocalIssueTracking {
- private static final Logger LOG = LoggerFactory.getLogger(LocalIssueTracking.class);
-
private final IssueCache issueCache;
private final IssueTracking tracking;
private final ServerLineHashesLoader lastLineHashes;
package org.sonar.batch.issue.tracking;
import com.google.common.base.Function;
-
import javax.annotation.Nullable;
-
import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.utils.log.Logger;
}
}
- private String getVersion(ProjectDefinition def) {
+ private static String getVersion(ProjectDefinition def) {
String version = def.getVersion();
return StringUtils.isNotBlank(version) ? version : getVersion(def.getParent());
}
}
}
- private void writeProjectLink(BatchReport.Component.Builder componentBuilder, ProjectDefinition def, ComponentLink.Builder linkBuilder, String linkProp,
+ private static void writeProjectLink(BatchReport.Component.Builder componentBuilder, ProjectDefinition def, ComponentLink.Builder linkBuilder, String linkProp,
ComponentLinkType linkType) {
String link = def.properties().get(linkProp);
if (StringUtils.isNotBlank(link)) {
}
@CheckForNull
- private String getLanguageKey(Resource r) {
+ private static String getLanguageKey(Resource r) {
Language language = r.getLanguage();
return ResourceUtils.isFile(r) && language != null ? language.getKey() : null;
}
@CheckForNull
- private String getName(Resource r) {
+ private static String getName(Resource r) {
// Don't return name for directories and files since it can be guessed from the path
return (ResourceUtils.isFile(r) || ResourceUtils.isDirectory(r)) ? null : r.getName();
}
@CheckForNull
- private String getDescription(Resource r) {
+ private static String getDescription(Resource r) {
// Only for projets and modules
return ResourceUtils.isProject(r) ? r.getDescription() : null;
}
return singleton;
}
- private RulesProfile loadSingleLanguageProfile(ModuleQProfiles qProfiles, ActiveRules activeRules, String language) {
+ private static RulesProfile loadSingleLanguageProfile(ModuleQProfiles qProfiles, ActiveRules activeRules, String language) {
QProfile qProfile = qProfiles.findByLanguage(language);
if (qProfile != null) {
return new RulesProfileWrapper(select(qProfile, activeRules));
return new RulesProfileWrapper(Lists.<RulesProfile>newArrayList());
}
- private RulesProfile loadProfiles(ModuleQProfiles qProfiles, ActiveRules activeRules) {
+ private static RulesProfile loadProfiles(ModuleQProfiles qProfiles, ActiveRules activeRules) {
Collection<RulesProfile> dtos = Lists.newArrayList();
for (QProfile qProfile : qProfiles.findAll()) {
dtos.add(select(qProfile, activeRules));
return new RulesProfileWrapper(dtos);
}
- private RulesProfile select(QProfile qProfile, ActiveRules activeRules) {
+ private static RulesProfile select(QProfile qProfile, ActiveRules activeRules) {
RulesProfile deprecatedProfile = new RulesProfile();
// TODO deprecatedProfile.setVersion(qProfile.version());
deprecatedProfile.setName(qProfile.getName());
return new ProjectReactor(rootProject);
}
- private Map<String, Map<String, String>> extractPropertiesByModule(String currentModuleId, Map<String, String> parentProperties) {
+ private static Map<String, Map<String, String>> extractPropertiesByModule(String currentModuleId, Map<String, String> parentProperties) {
Map<String, String> allProperties = new HashMap<>();
allProperties.putAll(parentProperties);
Map<String, String> currentModuleProperties = new HashMap<>();
}
@CheckForNull
- private File initModuleBuildDir(File moduleBaseDir, Map<String, String> moduleProperties) {
+ private static File initModuleBuildDir(File moduleBaseDir, Map<String, String> moduleProperties) {
String buildDir = moduleProperties.get(PROPERTY_PROJECT_BUILDDIR);
if (StringUtils.isBlank(buildDir)) {
return null;
}
}
- private void validateModule(ProjectDefinition moduleDef, List<String> validationMessages, @Nullable String branch, String rootProjectKey) {
+ private static void validateModule(ProjectDefinition moduleDef, List<String> validationMessages, @Nullable String branch, String rootProjectKey) {
if (!ComponentKeys.isValidModuleKey(moduleDef.getKey())) {
validationMessages.add(String.format("\"%s\" is not a valid project or module key. "
+ "Allowed characters are alphanumeric, '-', '_', '.' and ':', with at least one non-digit.", moduleDef.getKey()));
}
}
- private void validateBranch(List<String> validationMessages, @Nullable String branch) {
+ private static void validateBranch(List<String> validationMessages, @Nullable String branch) {
if (StringUtils.isNotEmpty(branch) && !ComponentKeys.isValidBranch(branch)) {
validationMessages.add(String.format("\"%s\" is not a valid branch name. "
+ "Allowed characters are alphanumeric, '-', '_', '.' and '/'.", branch));
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.fs.FilePredicate;
import org.sonar.api.scan.filesystem.ModuleFileSystem;
import org.sonar.api.utils.MessageException;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
/**
* @since 3.5
*/
return testDirsOrFiles;
}
- private List<File> keepOnlyDirs(List<File> dirsOrFiles) {
+ private static List<File> keepOnlyDirs(List<File> dirsOrFiles) {
List<File> result = new ArrayList<>();
for (File f : dirsOrFiles) {
if (f.isDirectory()) {
throw modificationNotPermitted();
}
- private UnsupportedOperationException modificationNotPermitted() {
+ private static UnsupportedOperationException modificationNotPermitted() {
return new UnsupportedOperationException("Modifications of the file system are not permitted");
}
package org.sonar.batch.scan.filesystem;
import com.google.common.annotations.VisibleForTesting;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.sonar.api.batch.BatchSide;
-import org.sonar.api.scan.filesystem.PathResolver;
-
import java.io.File;
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.sonar.api.batch.BatchSide;
+import org.sonar.api.scan.filesystem.PathResolver;
@BatchSide
public class FileSystemLogger {
}
}
- private void logPaths(Logger logger, String label, File baseDir, List<File> paths) {
+ private static void logPaths(Logger logger, String label, File baseDir, List<File> paths) {
if (!paths.isEmpty()) {
PathResolver resolver = new PathResolver();
StringBuilder sb = new StringBuilder(label);
value.putString(persistenceMode != null ? persistenceMode.name() : null);
}
- private void putUTFOrNull(Value value, @Nullable String utfOrNull) {
+ private static void putUTFOrNull(Value value, @Nullable String utfOrNull) {
if (utfOrNull != null) {
value.putUTF(utfOrNull);
} else {
import org.sonar.api.Property;
import org.sonar.api.PropertyType;
import org.sonar.api.config.Settings;
-import org.sonar.core.issue.DefaultIssue;
import org.sonar.api.rule.Severity;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.batch.issue.IssueCache;
import org.sonar.batch.scan.filesystem.InputPathCache;
+import org.sonar.core.issue.DefaultIssue;
@Properties({
@Property(key = ConsoleReport.CONSOLE_REPORT_ENABLED_KEY, name = "Enable console report", description = "Set this to true to generate a report in console output",
}
}
- private void printNewIssues(StringBuilder sb, int issueCount, String severity, String severityLabel) {
+ private static void printNewIssues(StringBuilder sb, int issueCount, String severity, String severityLabel) {
if (issueCount > 0) {
sb.append(StringUtils.leftPad("+" + issueCount, LEFT_PAD)).append(" ").append(severityLabel).append("\n");
}
*/
package org.sonar.batch.scan.report;
-import org.sonar.api.batch.rule.Rule;
-
-import org.sonar.api.batch.rule.Rules;
+import javax.annotation.CheckForNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.batch.BatchSide;
+import org.sonar.api.batch.rule.Rule;
+import org.sonar.api.batch.rule.Rules;
import org.sonar.api.issue.Issue;
-import org.sonar.core.issue.DefaultIssue;
import org.sonar.api.resources.Project;
import org.sonar.api.rules.RulePriority;
import org.sonar.batch.DefaultProjectTree;
import org.sonar.batch.index.BatchComponentCache;
import org.sonar.batch.issue.IssueCache;
import org.sonar.batch.scan.filesystem.InputPathCache;
-
-import javax.annotation.CheckForNull;
+import org.sonar.core.issue.DefaultIssue;
@BatchSide
public class IssuesReportBuilder {
}
}
- private boolean validate(Issue issue, Rule rule, BatchComponent resource) {
+ private static boolean validate(Issue issue, Rule rule, BatchComponent resource) {
if (rule == null) {
LOG.warn("Unknow rule for issue {}", issue);
return false;
}
}
- private int compareByRuleSeverityAndName(RuleReport o1, RuleReport o2) {
+ private static int compareByRuleSeverityAndName(RuleReport o1, RuleReport o2) {
return o1.getReportRuleKey().compareTo(o2.getReportRuleKey());
}
- private boolean sameNewIssueCount(RuleReport o1, RuleReport o2) {
+ private static boolean sameNewIssueCount(RuleReport o1, RuleReport o2) {
return o2.getTotal().getNewIssuesCount() == o1.getTotal().getNewIssuesCount();
}
- private boolean sameSeverity(RuleReport o1, RuleReport o2) {
+ private static boolean sameSeverity(RuleReport o1, RuleReport o2) {
return o1.getSeverity().equals(o2.getSeverity());
}
- private int compareNewIssueCount(RuleReport o1, RuleReport o2) {
+ private static int compareNewIssueCount(RuleReport o1, RuleReport o2) {
return o2.getTotal().getNewIssuesCount() - o1.getTotal().getNewIssuesCount();
}
- private boolean bothHaveNewIssues(RuleReport o1, RuleReport o2) {
+ private static boolean bothHaveNewIssues(RuleReport o1, RuleReport o2) {
return o1.getTotal().getNewIssuesCount() > 0 && o2.getTotal().getNewIssuesCount() > 0;
}
- private boolean bothHaveNoNewIssue(RuleReport o1, RuleReport o2) {
+ private static boolean bothHaveNoNewIssue(RuleReport o1, RuleReport o2) {
return o1.getTotal().getNewIssuesCount() == 0 && o2.getTotal().getNewIssuesCount() == 0;
}
}
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.batch.index.BatchComponent;
-import org.sonar.batch.scan.filesystem.InputPathCache;
@BatchSide
public class SourceProvider {
private static final Logger LOG = LoggerFactory.getLogger(SourceProvider.class);
- private final InputPathCache inputPathCache;
private final FileSystem fs;
- public SourceProvider(InputPathCache inputPathCache, FileSystem fs) {
- this.inputPathCache = inputPathCache;
+ public SourceProvider(FileSystem fs) {
this.fs = fs;
}
package org.sonar.batch.scm;
import com.google.common.base.Preconditions;
+import java.text.Normalizer;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;
+import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.batch.protocol.output.BatchReportWriter;
import org.sonar.batch.util.ProgressReport;
-import javax.annotation.Nullable;
-
-import java.text.Normalizer;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-import java.util.regex.Pattern;
-
class DefaultBlameOutput implements BlameOutput {
private static final Logger LOG = LoggerFactory.getLogger(DefaultBlameOutput.class);
progressReport.message(count + "/" + total + " files analyzed, last one was " + file.absolutePath());
}
- private void addChangeset(Builder scmBuilder, BlameLine line) {
+ private static void addChangeset(Builder scmBuilder, BlameLine line) {
BatchReport.Changesets.Changeset.Builder changesetBuilder = BatchReport.Changesets.Changeset.newBuilder();
if (StringUtils.isNotBlank(line.revision())) {
changesetBuilder.setRevision(line.revision());
scmBuilder.addChangeset(changesetBuilder.build());
}
- private String normalizeString(@Nullable String inputString) {
+ private static String normalizeString(@Nullable String inputString) {
if (inputString == null) {
return "";
}
return removeNonAsciiCharacters(stringWithoutAccents);
}
- private String removeAccents(String inputString) {
+ private static String removeAccents(String inputString) {
String unicodeDecomposedString = Normalizer.normalize(inputString, Normalizer.Form.NFD);
return ACCENT_CODES.matcher(unicodeDecomposedString).replaceAll("");
}
- private String removeNonAsciiCharacters(String inputString) {
+ private static String removeNonAsciiCharacters(String inputString) {
return NON_ASCII_CHARS.matcher(inputString).replaceAll("_");
}
*/
package org.sonar.batch.scm;
+import java.util.LinkedList;
+import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.CoreProperties;
import org.sonar.batch.report.ReportPublisher;
import org.sonar.batch.scan.filesystem.InputPathCache;
-import java.util.LinkedList;
-import java.util.List;
-
public final class ScmSensor implements Sensor {
private static final Logger LOG = LoggerFactory.getLogger(ScmSensor.class);
return filesToBlame;
}
- private void addIfNotEmpty(List<InputFile> filesToBlame, InputFile f) {
+ private static void addIfNotEmpty(List<InputFile> filesToBlame, InputFile f) {
if (!f.isEmpty()) {
filesToBlame.add(f);
}
log("Excluded sources for coverage: ", resourcePatterns);
}
- private void log(String title, Collection<WildcardPattern> patterns) {
+ private static void log(String title, Collection<WildcardPattern> patterns) {
if (!patterns.isEmpty()) {
LOG.info(title);
for (WildcardPattern pattern : patterns) {
throw unsupported();
}
- private UnsupportedOperationException unsupported() {
+ private static UnsupportedOperationException unsupported() {
return new UnsupportedOperationException("No more available since SQ 5.2");
}
public DefaultIssue setCreationDate(Date d) {
// d is not marked as Nullable but we still allow null parameter for unit testing.
- this.creationDate = (d != null ? DateUtils.truncate(d, Calendar.SECOND) : null);
+ this.creationDate = d != null ? DateUtils.truncate(d, Calendar.SECOND) : null;
return this;
}
}
public DefaultIssue setUpdateDate(@Nullable Date d) {
- this.updateDate = (d != null ? DateUtils.truncate(d, Calendar.SECOND) : null);
+ this.updateDate = d != null ? DateUtils.truncate(d, Calendar.SECOND) : null;
return this;
}
}
public DefaultIssue setCloseDate(@Nullable Date d) {
- this.closeDate = (d != null ? DateUtils.truncate(d, Calendar.SECOND) : null);
+ this.closeDate = d != null ? DateUtils.truncate(d, Calendar.SECOND) : null;
return this;
}
import org.apache.commons.dbutils.DbUtils;
import org.sonar.db.Database;
-class SelectImpl extends BaseSqlStatement<Select> implements Select {
+class SelectImpl extends BaseSqlStatement<Select>implements Select {
private SelectImpl(PreparedStatement pstmt) {
super(pstmt);
}
}
- private IllegalStateException newExceptionWithRowDetails(Select.Row row, Exception e) {
+ private static IllegalStateException newExceptionWithRowDetails(Select.Row row, Exception e) {
return new IllegalStateException("Error during processing of row: [" + row + "]", e);
}
public class DefaultIssue extends DefaultStorable implements Issue, NewIssue {
+ private static final class ToExecutionFlow implements Function<List<IssueLocation>, ExecutionFlow> {
+ @Override
+ public ExecutionFlow apply(final List<IssueLocation> input) {
+ return new ExecutionFlow() {
+ @Override
+ public List<IssueLocation> locations() {
+ return ImmutableList.copyOf(input);
+ }
+ };
+ }
+ }
+
private RuleKey ruleKey;
private Double effortToFix;
private Severity overriddenSeverity;
@Override
public List<ExecutionFlow> executionFlows() {
- return Lists.transform(this.executionFlows, new Function<List<IssueLocation>, ExecutionFlow>() {
- @Override
- public ExecutionFlow apply(final List<IssueLocation> input) {
- return new ExecutionFlow() {
- @Override
- public List<IssueLocation> locations() {
- return ImmutableList.copyOf(input);
- }
- };
- }
- });
+ return Lists.transform(this.executionFlows, new ToExecutionFlow());
}
@Override