diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-11-12 14:45:00 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-11-20 13:37:25 +0100 |
commit | 1787a07549561cb576eeeeb31e2208b753d20cb3 (patch) | |
tree | b22466e2b32047ccb5cf686687639b0f2939fe55 /sonar-plugin-api/src/main/java/org/sonar/api/checks | |
parent | 2cd1a9722bf414d3ab9eb73a40bd138821a362e2 (diff) | |
download | sonarqube-1787a07549561cb576eeeeb31e2208b753d20cb3.tar.gz sonarqube-1787a07549561cb576eeeeb31e2208b753d20cb3.zip |
SONAR-7057 Delete deprecated org.sonar.api.checks.NoSonarFilter
Diffstat (limited to 'sonar-plugin-api/src/main/java/org/sonar/api/checks')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/checks/NoSonarFilter.java | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/checks/NoSonarFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/checks/NoSonarFilter.java deleted file mode 100644 index b8e4401d7f5..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/checks/NoSonarFilter.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.api.checks; - -import org.sonar.api.scan.issue.filter.FilterableIssue; - -import org.sonar.api.scan.issue.filter.IssueFilter; -import com.google.common.collect.Maps; -import org.apache.commons.lang.StringUtils; -import org.sonar.api.batch.SonarIndex; -import org.sonar.api.scan.issue.filter.IssueFilterChain; -import org.sonar.api.resources.Resource; - -import java.util.Map; -import java.util.Set; - -/** - * @since 2.1 - * @deprecated in 3.6. Replaced by {@link org.sonar.api.issue.NoSonarFilter} - */ -@Deprecated -public class NoSonarFilter implements IssueFilter { - - private final Map<String, Set<Integer>> noSonarLinesByKey = Maps.newHashMap(); - private SonarIndex sonarIndex; - - public NoSonarFilter(SonarIndex sonarIndex) { - this.sonarIndex = sonarIndex; - } - - public void addResource(Resource model, Set<Integer> noSonarLines) { - if (model != null && noSonarLines != null) { - // Reload resource to handle backward compatibility of resource keys - Resource resource = sonarIndex.getResource(model); - if (resource != null) { - noSonarLinesByKey.put(resource.getEffectiveKey(), noSonarLines); - } - } - } - - @Override - public boolean accept(FilterableIssue issue, IssueFilterChain chain) { - boolean accepted = true; - if (issue.line() != null) { - Set<Integer> noSonarLines = noSonarLinesByKey.get(issue.componentKey()); - accepted = noSonarLines == null || !noSonarLines.contains(issue.line()); - if (!accepted && StringUtils.containsIgnoreCase(issue.ruleKey().rule(), "nosonar")) { - accepted = true; - } - } - if (accepted) { - accepted = chain.accept(issue); - } - return accepted; - } -} |