From c128fb65044ab2664b459e741d2e793112f540e4 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Tue, 18 Feb 2014 15:00:19 +0100 Subject: [PATCH] Issue exclusions patterns are now initialized prior to sensor phase --- .../org/sonar/plugins/core/CorePlugin.java | 101 +++++++++++++++--- .../core/issue/ignore/IgnoreIssuesPlugin.java | 52 --------- .../issue/ignore/EnforceIssuesFilter.java | 11 +- .../issue/ignore/IgnoreIssuesFilter.java | 11 +- .../ignore/IssueExclusionsConfiguration.java | 6 +- .../batch}/issue/ignore/package-info.java | 2 +- .../pattern/AbstractPatternInitializer.java | 9 +- .../IssueExclusionPatternInitializer.java | 25 ++--- .../IssueInclusionPatternInitializer.java | 11 +- .../issue/ignore/pattern/IssuePattern.java | 2 +- .../issue/ignore/pattern/LineRange.java | 2 +- .../issue/ignore/pattern/PatternDecoder.java | 2 +- .../issue/ignore/pattern/PatternMatcher.java | 2 +- .../issue/ignore/pattern}/package-info.java | 2 +- .../ignore/scanner/IssueExclusionsLoader.java | 27 ++--- .../scanner/IssueExclusionsRegexpScanner.java | 17 +-- .../issue/ignore/scanner}/package-info.java | 2 +- .../org/sonar/batch/phases/PhaseExecutor.java | 14 ++- .../sonar/batch/scan/ModuleScanContainer.java | 15 +++ .../issue/ignore/EnforceIssuesFilterTest.java | 13 +-- .../issue/ignore/IgnoreIssuesFilterTest.java | 15 +-- .../IssueExclusionsConfigurationTest.java | 9 +- .../IssueExclusionPatternInitializerTest.java | 67 ++++++------ .../IssueInclusionPatternInitializerTest.java | 25 ++--- .../ignore/pattern/IssuePatternTest.java | 5 +- .../issue/ignore/pattern/LineRangeTest.java | 5 +- .../ignore/pattern/PatternDecoderTest.java | 5 +- .../ignore/pattern/PatternMatcherTest.java | 8 +- .../scanner/IssueExclusionsLoaderTest.java | 36 +++---- .../IssueExclusionsRegexpScannerTest.java | 20 ++-- .../file-with-double-regexp-mess.txt | 0 .../file-with-double-regexp-twice.txt | 0 .../file-with-double-regexp-unfinished.txt | 0 .../file-with-double-regexp-wrong-order.txt | 0 .../file-with-double-regexp.txt | 0 .../file-with-no-regexp.txt | 0 ...e-with-single-regexp-and-double-regexp.txt | 0 .../file-with-single-regexp.txt | 0 38 files changed, 290 insertions(+), 231 deletions(-) delete mode 100644 plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesPlugin.java rename {plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core => sonar-batch/src/main/java/org/sonar/batch}/issue/ignore/EnforceIssuesFilter.java (87%) rename {plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core => sonar-batch/src/main/java/org/sonar/batch}/issue/ignore/IgnoreIssuesFilter.java (84%) rename plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesConfiguration.java => sonar-batch/src/main/java/org/sonar/batch/issue/ignore/IssueExclusionsConfiguration.java (98%) rename {plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core => sonar-batch/src/main/java/org/sonar/batch}/issue/ignore/package-info.java (95%) rename {plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core => sonar-batch/src/main/java/org/sonar/batch}/issue/ignore/pattern/AbstractPatternInitializer.java (91%) rename plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/ExclusionPatternInitializer.java => sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssueExclusionPatternInitializer.java (81%) rename plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/InclusionPatternInitializer.java => sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssueInclusionPatternInitializer.java (81%) rename {plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core => sonar-batch/src/main/java/org/sonar/batch}/issue/ignore/pattern/IssuePattern.java (98%) rename {plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core => sonar-batch/src/main/java/org/sonar/batch}/issue/ignore/pattern/LineRange.java (97%) rename {plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core => sonar-batch/src/main/java/org/sonar/batch}/issue/ignore/pattern/PatternDecoder.java (98%) rename {plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core => sonar-batch/src/main/java/org/sonar/batch}/issue/ignore/pattern/PatternMatcher.java (97%) rename {plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner => sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern}/package-info.java (94%) rename plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesSourceScanner.java => sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoader.java (71%) rename plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScanner.java => sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScanner.java (91%) rename {plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern => sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner}/package-info.java (94%) rename {plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core => sonar-batch/src/test/java/org/sonar/batch}/issue/ignore/EnforceIssuesFilterTest.java (93%) rename {plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core => sonar-batch/src/test/java/org/sonar/batch}/issue/ignore/IgnoreIssuesFilterTest.java (83%) rename plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesPluginTest.java => sonar-batch/src/test/java/org/sonar/batch/issue/ignore/IssueExclusionsConfigurationTest.java (81%) rename plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/ExclusionPatternInitializerTest.java => sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssueExclusionPatternInitializerTest.java (52%) rename plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/InclusionPatternInitializerTest.java => sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssueInclusionPatternInitializerTest.java (64%) rename {plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core => sonar-batch/src/test/java/org/sonar/batch}/issue/ignore/pattern/IssuePatternTest.java (97%) rename {plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core => sonar-batch/src/test/java/org/sonar/batch}/issue/ignore/pattern/LineRangeTest.java (95%) rename {plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core => sonar-batch/src/test/java/org/sonar/batch}/issue/ignore/pattern/PatternDecoderTest.java (97%) rename {plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core => sonar-batch/src/test/java/org/sonar/batch}/issue/ignore/pattern/PatternMatcherTest.java (93%) rename plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesSourceScannerTest.java => sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java (86%) rename plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest.java => sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java (90%) rename {plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest => sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest}/file-with-double-regexp-mess.txt (100%) rename {plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest => sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest}/file-with-double-regexp-twice.txt (100%) rename {plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest => sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest}/file-with-double-regexp-unfinished.txt (100%) rename {plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest => sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest}/file-with-double-regexp-wrong-order.txt (100%) rename {plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest => sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest}/file-with-double-regexp.txt (100%) rename {plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest => sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest}/file-with-no-regexp.txt (100%) rename {plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest => sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest}/file-with-single-regexp-and-double-regexp.txt (100%) rename {plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest => sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest}/file-with-single-regexp.txt (100%) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java index 57f1b91037b..0d2bd21ac5e 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java @@ -19,8 +19,14 @@ */ package org.sonar.plugins.core; +import org.sonar.batch.issue.ignore.IssueExclusionsConfiguration; + import com.google.common.collect.ImmutableList; -import org.sonar.api.*; +import org.sonar.api.CoreProperties; +import org.sonar.api.Properties; +import org.sonar.api.Property; +import org.sonar.api.PropertyType; +import org.sonar.api.SonarPlugin; import org.sonar.api.checks.NoSonarFilter; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; @@ -33,22 +39,92 @@ import org.sonar.plugins.core.charts.DistributionAreaChart; import org.sonar.plugins.core.charts.DistributionBarChart; import org.sonar.plugins.core.charts.XradarChart; import org.sonar.plugins.core.colorizers.JavaColorizerFormat; -import org.sonar.plugins.core.dashboards.*; -import org.sonar.plugins.core.issue.*; -import org.sonar.plugins.core.issue.ignore.IgnoreIssuesPlugin; -import org.sonar.plugins.core.issue.notification.*; +import org.sonar.plugins.core.dashboards.GlobalDefaultDashboard; +import org.sonar.plugins.core.dashboards.ProjectDefaultDashboard; +import org.sonar.plugins.core.dashboards.ProjectHotspotDashboard; +import org.sonar.plugins.core.dashboards.ProjectIssuesDashboard; +import org.sonar.plugins.core.dashboards.ProjectTimeMachineDashboard; +import org.sonar.plugins.core.issue.CountFalsePositivesDecorator; +import org.sonar.plugins.core.issue.CountUnresolvedIssuesDecorator; +import org.sonar.plugins.core.issue.InitialOpenIssuesSensor; +import org.sonar.plugins.core.issue.InitialOpenIssuesStack; +import org.sonar.plugins.core.issue.IssueHandlers; +import org.sonar.plugins.core.issue.IssueTracking; +import org.sonar.plugins.core.issue.IssueTrackingDecorator; +import org.sonar.plugins.core.issue.IssuesDensityDecorator; +import org.sonar.plugins.core.issue.WeightedIssuesDecorator; +import org.sonar.plugins.core.issue.notification.ChangesOnMyIssueNotificationDispatcher; +import org.sonar.plugins.core.issue.notification.IssueChangesEmailTemplate; +import org.sonar.plugins.core.issue.notification.NewFalsePositiveNotificationDispatcher; +import org.sonar.plugins.core.issue.notification.NewIssuesEmailTemplate; +import org.sonar.plugins.core.issue.notification.NewIssuesNotificationDispatcher; +import org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob; import org.sonar.plugins.core.measurefilters.MyFavouritesFilter; import org.sonar.plugins.core.measurefilters.ProjectFilter; import org.sonar.plugins.core.notifications.alerts.NewAlerts; import org.sonar.plugins.core.security.ApplyProjectRolesDecorator; -import org.sonar.plugins.core.sensors.*; +import org.sonar.plugins.core.sensors.BranchCoverageDecorator; +import org.sonar.plugins.core.sensors.CheckAlertThresholds; +import org.sonar.plugins.core.sensors.CommentDensityDecorator; +import org.sonar.plugins.core.sensors.CoverageDecorator; +import org.sonar.plugins.core.sensors.CoverageMeasurementFilter; +import org.sonar.plugins.core.sensors.DirectoriesDecorator; +import org.sonar.plugins.core.sensors.FileHashSensor; +import org.sonar.plugins.core.sensors.FilesDecorator; +import org.sonar.plugins.core.sensors.GenerateAlertEvents; +import org.sonar.plugins.core.sensors.ItBranchCoverageDecorator; +import org.sonar.plugins.core.sensors.ItCoverageDecorator; +import org.sonar.plugins.core.sensors.ItLineCoverageDecorator; +import org.sonar.plugins.core.sensors.LineCoverageDecorator; +import org.sonar.plugins.core.sensors.ManualMeasureDecorator; +import org.sonar.plugins.core.sensors.OverallBranchCoverageDecorator; +import org.sonar.plugins.core.sensors.OverallCoverageDecorator; +import org.sonar.plugins.core.sensors.OverallLineCoverageDecorator; +import org.sonar.plugins.core.sensors.ProfileEventsSensor; +import org.sonar.plugins.core.sensors.ProjectLinksSensor; +import org.sonar.plugins.core.sensors.UnitTestDecorator; +import org.sonar.plugins.core.sensors.VersionEventsSensor; import org.sonar.plugins.core.technicaldebt.NewTechnicalDebtDecorator; import org.sonar.plugins.core.technicaldebt.TechnicalDebtDecorator; -import org.sonar.plugins.core.timemachine.*; +import org.sonar.plugins.core.timemachine.NewCoverageAggregator; +import org.sonar.plugins.core.timemachine.NewCoverageFileAnalyzer; +import org.sonar.plugins.core.timemachine.NewItCoverageFileAnalyzer; +import org.sonar.plugins.core.timemachine.NewOverallCoverageFileAnalyzer; +import org.sonar.plugins.core.timemachine.TendencyDecorator; +import org.sonar.plugins.core.timemachine.TimeMachineConfigurationPersister; +import org.sonar.plugins.core.timemachine.VariationDecorator; import org.sonar.plugins.core.web.TestsViewer; -import org.sonar.plugins.core.widgets.*; -import org.sonar.plugins.core.widgets.issues.*; -import org.sonar.plugins.core.widgets.measures.*; +import org.sonar.plugins.core.widgets.AlertsWidget; +import org.sonar.plugins.core.widgets.BubbleChartWidget; +import org.sonar.plugins.core.widgets.ComplexityWidget; +import org.sonar.plugins.core.widgets.CoverageWidget; +import org.sonar.plugins.core.widgets.CustomMeasuresWidget; +import org.sonar.plugins.core.widgets.DescriptionWidget; +import org.sonar.plugins.core.widgets.DocumentationCommentsWidget; +import org.sonar.plugins.core.widgets.DuplicationsWidget; +import org.sonar.plugins.core.widgets.EventsWidget; +import org.sonar.plugins.core.widgets.HotspotMetricWidget; +import org.sonar.plugins.core.widgets.HotspotMostViolatedResourcesWidget; +import org.sonar.plugins.core.widgets.HotspotMostViolatedRulesWidget; +import org.sonar.plugins.core.widgets.ItCoverageWidget; +import org.sonar.plugins.core.widgets.SizeWidget; +import org.sonar.plugins.core.widgets.TechnicalDebtPyramidWidget; +import org.sonar.plugins.core.widgets.TimeMachineWidget; +import org.sonar.plugins.core.widgets.TimelineWidget; +import org.sonar.plugins.core.widgets.TreemapWidget; +import org.sonar.plugins.core.widgets.WelcomeWidget; +import org.sonar.plugins.core.widgets.issues.ActionPlansWidget; +import org.sonar.plugins.core.widgets.issues.FalsePositiveIssuesWidget; +import org.sonar.plugins.core.widgets.issues.IssueFilterWidget; +import org.sonar.plugins.core.widgets.issues.IssuesWidget; +import org.sonar.plugins.core.widgets.issues.MyUnresolvedIssuesWidget; +import org.sonar.plugins.core.widgets.issues.UnresolvedIssuesPerAssigneeWidget; +import org.sonar.plugins.core.widgets.issues.UnresolvedIssuesStatusesWidget; +import org.sonar.plugins.core.widgets.measures.MeasureFilterAsBubbleChartWidget; +import org.sonar.plugins.core.widgets.measures.MeasureFilterAsHistogramWidget; +import org.sonar.plugins.core.widgets.measures.MeasureFilterAsPieChartWidget; +import org.sonar.plugins.core.widgets.measures.MeasureFilterListWidget; +import org.sonar.plugins.core.widgets.measures.MeasureFilterTreemapWidget; import java.util.Arrays; import java.util.List; @@ -194,7 +270,8 @@ import java.util.List; @Property( key = CoreProperties.CORE_AUTHENTICATOR_LOCAL_USERS, name = "Local/technical users", - description = "Comma separated list of user logins that will always be authenticated using SonarQube database. When using the LDAP plugin, for these accounts, the user attributes (name, email, ...) are not re-synchronized", + description = "Comma separated list of user logins that will always be authenticated using SonarQube database. " + + "When using the LDAP plugin, for these accounts, the user attributes (name, email, ...) are not re-synchronized", project = false, global = false, defaultValue = "admin", @@ -336,7 +413,7 @@ public final class CorePlugin extends SonarPlugin { NewAlerts.newMetadata()); extensions.addAll(ExclusionProperties.definitions()); - extensions.addAll(IgnoreIssuesPlugin.getExtensions()); + extensions.addAll(IssueExclusionsConfiguration.getPropertyDefinitions()); extensions.addAll(CoverageMeasurementFilter.getPropertyDefinitions()); extensions.addAll(PastSnapshotFinder.getPropertyDefinitions()); extensions.addAll(TechnicalDebtDecorator.definitions()); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesPlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesPlugin.java deleted file mode 100644 index c39060a912c..00000000000 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesPlugin.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 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.plugins.core.issue.ignore; - -import com.google.common.collect.ImmutableList; -import org.sonar.plugins.core.issue.ignore.pattern.ExclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.pattern.InclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.scanner.IgnoreIssuesRegexpScanner; -import org.sonar.plugins.core.issue.ignore.scanner.IgnoreIssuesSourceScanner; - -import java.util.List; - -public final class IgnoreIssuesPlugin { - - private IgnoreIssuesPlugin() { - // static extension declaration only - } - - public static List getExtensions() { - ImmutableList.Builder extensions = ImmutableList.builder(); - - extensions.addAll(IgnoreIssuesConfiguration.getPropertyDefinitions()); - extensions.add( - InclusionPatternInitializer.class, - ExclusionPatternInitializer.class, - IgnoreIssuesRegexpScanner.class, - IgnoreIssuesSourceScanner.class, - EnforceIssuesFilter.class, - IgnoreIssuesFilter.class); - - return extensions.build(); - } - -} diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/EnforceIssuesFilter.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/EnforceIssuesFilter.java similarity index 87% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/EnforceIssuesFilter.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/EnforceIssuesFilter.java index cd443178177..7245d904823 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/EnforceIssuesFilter.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/EnforceIssuesFilter.java @@ -17,23 +17,24 @@ * 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.plugins.core.issue.ignore; +package org.sonar.batch.issue.ignore; + +import org.sonar.batch.issue.ignore.pattern.IssueInclusionPatternInitializer; +import org.sonar.batch.issue.ignore.pattern.IssuePattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.issue.Issue; import org.sonar.api.issue.batch.IssueFilter; import org.sonar.api.issue.batch.IssueFilterChain; -import org.sonar.plugins.core.issue.ignore.pattern.InclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.pattern.IssuePattern; public class EnforceIssuesFilter implements IssueFilter { - private InclusionPatternInitializer patternInitializer; + private IssueInclusionPatternInitializer patternInitializer; private static final Logger LOG = LoggerFactory.getLogger(EnforceIssuesFilter.class); - public EnforceIssuesFilter(InclusionPatternInitializer patternInitializer) { + public EnforceIssuesFilter(IssueInclusionPatternInitializer patternInitializer) { this.patternInitializer = patternInitializer; } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesFilter.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/IgnoreIssuesFilter.java similarity index 84% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesFilter.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/IgnoreIssuesFilter.java index d49369dddae..d880bf6f8ca 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesFilter.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/IgnoreIssuesFilter.java @@ -17,16 +17,17 @@ * 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.plugins.core.issue.ignore; +package org.sonar.batch.issue.ignore; + +import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer; +import org.sonar.batch.issue.ignore.pattern.IssuePattern; +import org.sonar.batch.issue.ignore.pattern.PatternMatcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.issue.Issue; import org.sonar.api.issue.batch.IssueFilter; import org.sonar.api.issue.batch.IssueFilterChain; -import org.sonar.plugins.core.issue.ignore.pattern.ExclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.pattern.IssuePattern; -import org.sonar.plugins.core.issue.ignore.pattern.PatternMatcher; public class IgnoreIssuesFilter implements IssueFilter { @@ -34,7 +35,7 @@ public class IgnoreIssuesFilter implements IssueFilter { private static final Logger LOG = LoggerFactory.getLogger(IgnoreIssuesFilter.class); - public IgnoreIssuesFilter(ExclusionPatternInitializer patternInitializer) { + public IgnoreIssuesFilter(IssueExclusionPatternInitializer patternInitializer) { this.patternMatcher = patternInitializer.getPatternMatcher(); } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesConfiguration.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/IssueExclusionsConfiguration.java similarity index 98% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesConfiguration.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/IssueExclusionsConfiguration.java index 2f85575c379..441f08d468c 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesConfiguration.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/IssueExclusionsConfiguration.java @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore; +package org.sonar.batch.issue.ignore; import com.google.common.collect.ImmutableList; import org.sonar.api.CoreProperties; @@ -29,7 +29,7 @@ import org.sonar.api.resources.Qualifiers; import java.util.List; -public final class IgnoreIssuesConfiguration { +public final class IssueExclusionsConfiguration { public static final String SUB_CATEGORY_IGNORE_ISSUES = "issues"; @@ -56,7 +56,7 @@ public final class IgnoreIssuesConfiguration { static final int LARGE_SIZE = 40; static final int SMALL_SIZE = 10; - private IgnoreIssuesConfiguration() { + private IssueExclusionsConfiguration() { // static configuration declaration only } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/package-info.java similarity index 95% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/package-info.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/package-info.java index bdadd24e158..c25ccd37c3e 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/package-info.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/package-info.java @@ -18,6 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault -package org.sonar.plugins.core.issue.ignore; +package org.sonar.batch.issue.ignore; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/AbstractPatternInitializer.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/AbstractPatternInitializer.java similarity index 91% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/AbstractPatternInitializer.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/AbstractPatternInitializer.java index f8d23186c0e..10d5e5513d7 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/AbstractPatternInitializer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/AbstractPatternInitializer.java @@ -17,14 +17,15 @@ * 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.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; + +import org.sonar.batch.issue.ignore.IssueExclusionsConfiguration; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; import org.sonar.api.BatchExtension; import org.sonar.api.config.Settings; -import org.sonar.plugins.core.issue.ignore.IgnoreIssuesConfiguration; import java.util.List; @@ -66,8 +67,8 @@ public abstract class AbstractPatternInitializer implements BatchExtension { String patternConf = StringUtils.defaultIfBlank(settings.getString(getMulticriteriaConfigurationKey()), ""); for (String id : StringUtils.split(patternConf, ',')) { String propPrefix = getMulticriteriaConfigurationKey() + "." + id + "."; - String resourceKeyPattern = settings.getString(propPrefix + IgnoreIssuesConfiguration.RESOURCE_KEY); - String ruleKeyPattern = settings.getString(propPrefix + IgnoreIssuesConfiguration.RULE_KEY); + String resourceKeyPattern = settings.getString(propPrefix + IssueExclusionsConfiguration.RESOURCE_KEY); + String ruleKeyPattern = settings.getString(propPrefix + IssueExclusionsConfiguration.RULE_KEY); String lineRange = "*"; String[] fields = new String[] { resourceKeyPattern, ruleKeyPattern, lineRange }; PatternDecoder.checkRegularLineConstraints(StringUtils.join(fields, ","), fields); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/ExclusionPatternInitializer.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssueExclusionPatternInitializer.java similarity index 81% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/ExclusionPatternInitializer.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssueExclusionPatternInitializer.java index a20e8c33ba7..9cddda00fd8 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/ExclusionPatternInitializer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssueExclusionPatternInitializer.java @@ -18,25 +18,26 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; + +import org.sonar.batch.issue.ignore.IssueExclusionsConfiguration; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; import org.sonar.api.config.Settings; -import org.sonar.plugins.core.issue.ignore.IgnoreIssuesConfiguration; import java.util.List; import static com.google.common.base.Strings.nullToEmpty; -public class ExclusionPatternInitializer extends AbstractPatternInitializer { +public class IssueExclusionPatternInitializer extends AbstractPatternInitializer { private List blockPatterns; private List allFilePatterns; private PatternMatcher patternMatcher; - public ExclusionPatternInitializer(Settings settings) { + public IssueExclusionPatternInitializer(Settings settings) { super(settings); patternMatcher = new PatternMatcher(); loadFileContentPatterns(); @@ -44,7 +45,7 @@ public class ExclusionPatternInitializer extends AbstractPatternInitializer { @Override protected String getMulticriteriaConfigurationKey() { - return IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY; + return IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY; } public PatternMatcher getPatternMatcher() { @@ -69,11 +70,11 @@ public class ExclusionPatternInitializer extends AbstractPatternInitializer { protected final void loadFileContentPatterns() { // Patterns Block blockPatterns = Lists.newArrayList(); - String patternConf = StringUtils.defaultIfBlank(getSettings().getString(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY), ""); + String patternConf = StringUtils.defaultIfBlank(getSettings().getString(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY), ""); for (String id : StringUtils.split(patternConf, ',')) { - String propPrefix = IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY + "." + id + "."; - String beginBlockRegexp = getSettings().getString(propPrefix + IgnoreIssuesConfiguration.BEGIN_BLOCK_REGEXP); - String endBlockRegexp = getSettings().getString(propPrefix + IgnoreIssuesConfiguration.END_BLOCK_REGEXP); + String propPrefix = IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY + "." + id + "."; + String beginBlockRegexp = getSettings().getString(propPrefix + IssueExclusionsConfiguration.BEGIN_BLOCK_REGEXP); + String endBlockRegexp = getSettings().getString(propPrefix + IssueExclusionsConfiguration.END_BLOCK_REGEXP); String[] fields = new String[] { beginBlockRegexp, endBlockRegexp }; PatternDecoder.checkDoubleRegexpLineConstraints(StringUtils.join(fields, ","), fields); IssuePattern pattern = new IssuePattern().setBeginBlockRegexp(nullToEmpty(beginBlockRegexp)).setEndBlockRegexp(nullToEmpty(endBlockRegexp)); @@ -82,10 +83,10 @@ public class ExclusionPatternInitializer extends AbstractPatternInitializer { // Patterns All File allFilePatterns = Lists.newArrayList(); - patternConf = StringUtils.defaultIfBlank(getSettings().getString(IgnoreIssuesConfiguration.PATTERNS_ALLFILE_KEY), ""); + patternConf = StringUtils.defaultIfBlank(getSettings().getString(IssueExclusionsConfiguration.PATTERNS_ALLFILE_KEY), ""); for (String id : StringUtils.split(patternConf, ',')) { - String propPrefix = IgnoreIssuesConfiguration.PATTERNS_ALLFILE_KEY + "." + id + "."; - String allFileRegexp = getSettings().getString(propPrefix + IgnoreIssuesConfiguration.FILE_REGEXP); + String propPrefix = IssueExclusionsConfiguration.PATTERNS_ALLFILE_KEY + "." + id + "."; + String allFileRegexp = getSettings().getString(propPrefix + IssueExclusionsConfiguration.FILE_REGEXP); PatternDecoder.checkWholeFileRegexp(allFileRegexp); IssuePattern pattern = new IssuePattern().setAllFileRegexp(nullToEmpty(allFileRegexp)); allFilePatterns.add(pattern); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/InclusionPatternInitializer.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssueInclusionPatternInitializer.java similarity index 81% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/InclusionPatternInitializer.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssueInclusionPatternInitializer.java index 57dd0086c03..08f7ccaeba7 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/InclusionPatternInitializer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssueInclusionPatternInitializer.java @@ -18,26 +18,27 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; + +import org.sonar.batch.issue.ignore.IssueExclusionsConfiguration; import com.google.common.collect.Maps; import org.sonar.api.config.Settings; -import org.sonar.plugins.core.issue.ignore.IgnoreIssuesConfiguration; import java.util.Map; -public class InclusionPatternInitializer extends AbstractPatternInitializer { +public class IssueInclusionPatternInitializer extends AbstractPatternInitializer { private Map pathForComponent; - public InclusionPatternInitializer(Settings settings) { + public IssueInclusionPatternInitializer(Settings settings) { super(settings); pathForComponent = Maps.newHashMap(); } @Override protected String getMulticriteriaConfigurationKey() { - return IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY; + return IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY; } @Override diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/IssuePattern.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssuePattern.java similarity index 98% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/IssuePattern.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssuePattern.java index 458292a6e80..294afb629de 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/IssuePattern.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/IssuePattern.java @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; import com.google.common.collect.Sets; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/LineRange.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/LineRange.java similarity index 97% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/LineRange.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/LineRange.java index 743533d05f3..89433b8934f 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/LineRange.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/LineRange.java @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; import com.google.common.base.Preconditions; import com.google.common.collect.Sets; diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/PatternDecoder.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/PatternDecoder.java similarity index 98% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/PatternDecoder.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/PatternDecoder.java index 7912ed1e4c0..59f02ed891d 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/PatternDecoder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/PatternDecoder.java @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/PatternMatcher.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/PatternMatcher.java similarity index 97% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/PatternMatcher.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/PatternMatcher.java index a01be7b19a2..5de14be060a 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/PatternMatcher.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/PatternMatcher.java @@ -17,7 +17,7 @@ * 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.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/package-info.java similarity index 94% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/package-info.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/package-info.java index 9471f4ddeb2..d8d49069d04 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/package-info.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/package-info.java @@ -18,6 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault -package org.sonar.plugins.core.issue.ignore.scanner; +package org.sonar.batch.issue.ignore.pattern; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesSourceScanner.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoader.java similarity index 71% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesSourceScanner.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoader.java index f88696d7128..fbe61421f5f 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesSourceScanner.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoader.java @@ -18,35 +18,28 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.scanner; +package org.sonar.batch.issue.ignore.scanner; -import org.sonar.api.batch.DependedUpon; -import org.sonar.api.batch.Phase; -import org.sonar.api.batch.Sensor; -import org.sonar.api.batch.SensorContext; import org.sonar.api.resources.Project; import org.sonar.api.scan.filesystem.FileQuery; import org.sonar.api.scan.filesystem.InputFile; import org.sonar.api.scan.filesystem.internal.DefaultInputFile; import org.sonar.api.utils.SonarException; +import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer; +import org.sonar.batch.issue.ignore.pattern.IssueInclusionPatternInitializer; import org.sonar.batch.scan.filesystem.DefaultModuleFileSystem; -import org.sonar.java.api.JavaUtils; -import org.sonar.plugins.core.issue.ignore.pattern.ExclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.pattern.InclusionPatternInitializer; import java.nio.charset.Charset; -@Phase(name = Phase.Name.PRE) -// Issue Exclusions must be computed before JavaSquidSensor is executed and creates issues -@DependedUpon(value = JavaUtils.BARRIER_BEFORE_SQUID) -public final class IgnoreIssuesSourceScanner implements Sensor { +public final class IssueExclusionsLoader { - private final IgnoreIssuesRegexpScanner regexpScanner; - private final ExclusionPatternInitializer exclusionPatternInitializer; - private final InclusionPatternInitializer inclusionPatternInitializer; + private final IssueExclusionsRegexpScanner regexpScanner; + private final IssueExclusionPatternInitializer exclusionPatternInitializer; + private final IssueInclusionPatternInitializer inclusionPatternInitializer; private final DefaultModuleFileSystem fileSystem; - public IgnoreIssuesSourceScanner(IgnoreIssuesRegexpScanner regexpScanner, ExclusionPatternInitializer exclusionPatternInitializer, InclusionPatternInitializer inclusionPatternInitializer, + public IssueExclusionsLoader(IssueExclusionsRegexpScanner regexpScanner, IssueExclusionPatternInitializer exclusionPatternInitializer, + IssueInclusionPatternInitializer inclusionPatternInitializer, DefaultModuleFileSystem fileSystem) { this.regexpScanner = regexpScanner; this.exclusionPatternInitializer = exclusionPatternInitializer; @@ -62,7 +55,7 @@ public final class IgnoreIssuesSourceScanner implements Sensor { /** * {@inheritDoc} */ - public void analyse(Project project, SensorContext context) { + public void execute() { Charset sourcesEncoding = fileSystem.sourceCharset(); for (InputFile inputFile : fileSystem.inputFiles(FileQuery.all())) { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScanner.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScanner.java similarity index 91% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScanner.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScanner.java index d6fa2d26fa6..3ddbbaf57f7 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScanner.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScanner.java @@ -18,7 +18,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.scanner; +package org.sonar.batch.issue.ignore.scanner; + +import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer; +import org.sonar.batch.issue.ignore.pattern.IssuePattern; +import org.sonar.batch.issue.ignore.pattern.LineRange; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -27,9 +31,6 @@ import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.BatchExtension; -import org.sonar.plugins.core.issue.ignore.pattern.ExclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.pattern.IssuePattern; -import org.sonar.plugins.core.issue.ignore.pattern.LineRange; import java.io.File; import java.io.IOException; @@ -37,11 +38,11 @@ import java.nio.charset.Charset; import java.util.List; import java.util.Set; -public class IgnoreIssuesRegexpScanner implements BatchExtension { +public class IssueExclusionsRegexpScanner implements BatchExtension { - private static final Logger LOG = LoggerFactory.getLogger(IgnoreIssuesRegexpScanner.class); + private static final Logger LOG = LoggerFactory.getLogger(IssueExclusionsRegexpScanner.class); - private ExclusionPatternInitializer exclusionPatternInitializer; + private IssueExclusionPatternInitializer exclusionPatternInitializer; private List allFilePatterns; private List blockMatchers; @@ -51,7 +52,7 @@ public class IgnoreIssuesRegexpScanner implements BatchExtension { private List lineExclusions; private LineExclusion currentLineExclusion; - public IgnoreIssuesRegexpScanner(ExclusionPatternInitializer patternsInitializer) { + public IssueExclusionsRegexpScanner(IssueExclusionPatternInitializer patternsInitializer) { this.exclusionPatternInitializer = patternsInitializer; lineExclusions = Lists.newArrayList(); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/package-info.java similarity index 94% rename from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/package-info.java rename to sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/package-info.java index 55174ccde1c..89e3708cdbb 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/ignore/pattern/package-info.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/package-info.java @@ -18,6 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.scanner; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/PhaseExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/phases/PhaseExecutor.java index 8cc3ee7cee9..2043d7ee452 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/PhaseExecutor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/PhaseExecutor.java @@ -29,6 +29,7 @@ import org.sonar.batch.events.EventBus; import org.sonar.batch.index.DefaultIndex; import org.sonar.batch.index.PersistenceManager; import org.sonar.batch.index.ScanPersister; +import org.sonar.batch.issue.ignore.scanner.IssueExclusionsLoader; import org.sonar.batch.scan.filesystem.DefaultModuleFileSystem; import org.sonar.batch.scan.filesystem.FileSystemLogger; import org.sonar.batch.scan.maven.MavenPhaseExecutor; @@ -65,13 +66,15 @@ public final class PhaseExecutor { private final JsonReport jsonReport; private final DefaultModuleFileSystem fs; private final ProfileLogger profileLogger; + private final IssueExclusionsLoader issueExclusionsLoader; public PhaseExecutor(Phases phases, DecoratorsExecutor decoratorsExecutor, MavenPhaseExecutor mavenPhaseExecutor, MavenPluginsConfigurator mavenPluginsConfigurator, InitializersExecutor initializersExecutor, PostJobsExecutor postJobsExecutor, SensorsExecutor sensorsExecutor, PersistenceManager persistenceManager, SensorContext sensorContext, DefaultIndex index, EventBus eventBus, UpdateStatusJob updateStatusJob, ProjectInitializer pi, - ScanPersister[] persisters, FileSystemLogger fsLogger, JsonReport jsonReport, DefaultModuleFileSystem fs, ProfileLogger profileLogger) { + ScanPersister[] persisters, FileSystemLogger fsLogger, JsonReport jsonReport, DefaultModuleFileSystem fs, ProfileLogger profileLogger, + IssueExclusionsLoader issueExclusionsLoader) { this.phases = phases; this.decoratorsExecutor = decoratorsExecutor; this.mavenPhaseExecutor = mavenPhaseExecutor; @@ -90,15 +93,17 @@ public final class PhaseExecutor { this.jsonReport = jsonReport; this.fs = fs; this.profileLogger = profileLogger; + this.issueExclusionsLoader = issueExclusionsLoader; } public PhaseExecutor(Phases phases, DecoratorsExecutor decoratorsExecutor, MavenPhaseExecutor mavenPhaseExecutor, MavenPluginsConfigurator mavenPluginsConfigurator, InitializersExecutor initializersExecutor, PostJobsExecutor postJobsExecutor, SensorsExecutor sensorsExecutor, PersistenceManager persistenceManager, SensorContext sensorContext, DefaultIndex index, - EventBus eventBus, ProjectInitializer pi, ScanPersister[] persisters, FileSystemLogger fsLogger, JsonReport jsonReport, DefaultModuleFileSystem fs, ProfileLogger profileLogger) { + EventBus eventBus, ProjectInitializer pi, ScanPersister[] persisters, FileSystemLogger fsLogger, JsonReport jsonReport, + DefaultModuleFileSystem fs, ProfileLogger profileLogger, IssueExclusionsLoader issueExclusionsLoader) { this(phases, decoratorsExecutor, mavenPhaseExecutor, mavenPluginsConfigurator, initializersExecutor, postJobsExecutor, - sensorsExecutor, persistenceManager, sensorContext, index, eventBus, null, pi, persisters, fsLogger, jsonReport, fs, profileLogger); + sensorsExecutor, persistenceManager, sensorContext, index, eventBus, null, pi, persisters, fsLogger, jsonReport, fs, profileLogger, issueExclusionsLoader); } /** @@ -122,6 +127,9 @@ public final class PhaseExecutor { // Log detected languages and their profiles after FS is indexed and languages detected profileLogger.execute(); + // Initialize issue exclusions + issueExclusionsLoader.execute(); + sensorsExecutor.execute(sensorContext); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java index fbb5c6b9465..17c4182d137 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java @@ -19,6 +19,13 @@ */ package org.sonar.batch.scan; +import org.sonar.batch.issue.ignore.EnforceIssuesFilter; +import org.sonar.batch.issue.ignore.IgnoreIssuesFilter; +import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer; +import org.sonar.batch.issue.ignore.pattern.IssueInclusionPatternInitializer; +import org.sonar.batch.issue.ignore.scanner.IssueExclusionsLoader; +import org.sonar.batch.issue.ignore.scanner.IssueExclusionsRegexpScanner; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.BatchExtension; @@ -148,6 +155,14 @@ public class ModuleScanContainer extends ComponentContainer { IssuableFactory.class, ModuleIssues.class, + // issue exclusions + IssueInclusionPatternInitializer.class, + IssueExclusionPatternInitializer.class, + IssueExclusionsRegexpScanner.class, + IssueExclusionsLoader.class, + EnforceIssuesFilter.class, + IgnoreIssuesFilter.class, + ScanPerspectives.class); } diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/EnforceIssuesFilterTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/EnforceIssuesFilterTest.java similarity index 93% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/EnforceIssuesFilterTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/EnforceIssuesFilterTest.java index 3cba13dbd78..9c1731097e5 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/EnforceIssuesFilterTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/EnforceIssuesFilterTest.java @@ -18,7 +18,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore; +package org.sonar.batch.issue.ignore; + +import org.sonar.batch.issue.ignore.EnforceIssuesFilter; +import org.sonar.batch.issue.ignore.pattern.IssueInclusionPatternInitializer; +import org.sonar.batch.issue.ignore.pattern.IssuePattern; import com.google.common.collect.ImmutableList; import org.junit.Before; @@ -27,9 +31,6 @@ import org.sonar.api.issue.Issue; import org.sonar.api.issue.batch.IssueFilterChain; import org.sonar.api.rule.RuleKey; import org.sonar.api.utils.WildcardPattern; -import org.sonar.plugins.core.issue.ignore.pattern.InclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.pattern.IssuePattern; - import static org.fest.assertions.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -38,14 +39,14 @@ import static org.mockito.Mockito.when; public class EnforceIssuesFilterTest { - private InclusionPatternInitializer exclusionPatternInitializer; + private IssueInclusionPatternInitializer exclusionPatternInitializer; private EnforceIssuesFilter ignoreFilter; private Issue issue; private IssueFilterChain chain; @Before public void init() { - exclusionPatternInitializer = mock(InclusionPatternInitializer.class); + exclusionPatternInitializer = mock(IssueInclusionPatternInitializer.class); issue = mock(Issue.class); chain = mock(IssueFilterChain.class); when(chain.accept(issue)).thenReturn(true); diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesFilterTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/IgnoreIssuesFilterTest.java similarity index 83% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesFilterTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/IgnoreIssuesFilterTest.java index b582c101e03..2dae552a56a 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesFilterTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/IgnoreIssuesFilterTest.java @@ -18,23 +18,24 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore; +package org.sonar.batch.issue.ignore; + +import org.sonar.batch.issue.ignore.IgnoreIssuesFilter; +import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer; +import org.sonar.batch.issue.ignore.pattern.IssuePattern; +import org.sonar.batch.issue.ignore.pattern.PatternMatcher; import org.junit.Before; import org.junit.Test; import org.sonar.api.issue.Issue; import org.sonar.api.issue.batch.IssueFilterChain; -import org.sonar.plugins.core.issue.ignore.pattern.ExclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.pattern.IssuePattern; -import org.sonar.plugins.core.issue.ignore.pattern.PatternMatcher; - import static org.fest.assertions.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class IgnoreIssuesFilterTest { - private ExclusionPatternInitializer exclusionPatternInitializer; + private IssueExclusionPatternInitializer exclusionPatternInitializer; private PatternMatcher exclusionPatternMatcher; private IgnoreIssuesFilter ignoreFilter; private Issue issue; @@ -43,7 +44,7 @@ public class IgnoreIssuesFilterTest { @Before public void init() { exclusionPatternMatcher = mock(PatternMatcher.class); - exclusionPatternInitializer = mock(ExclusionPatternInitializer.class); + exclusionPatternInitializer = mock(IssueExclusionPatternInitializer.class); when(exclusionPatternInitializer.getPatternMatcher()).thenReturn(exclusionPatternMatcher); issue = mock(Issue.class); chain = mock(IssueFilterChain.class); diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesPluginTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/IssueExclusionsConfigurationTest.java similarity index 81% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesPluginTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/IssueExclusionsConfigurationTest.java index 339ebee90f3..ef93bd8a4c9 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/IgnoreIssuesPluginTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/IssueExclusionsConfigurationTest.java @@ -18,15 +18,16 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore; +package org.sonar.batch.issue.ignore; -import org.junit.Test; +import org.sonar.batch.issue.ignore.IssueExclusionsConfiguration; +import org.junit.Test; import static org.fest.assertions.Assertions.assertThat; -public class IgnoreIssuesPluginTest { +public class IssueExclusionsConfigurationTest { @Test public void justForCoverage() { - assertThat(IgnoreIssuesPlugin.getExtensions()).hasSize(4 /* properties */ + 6 /* extensions */); + assertThat(IssueExclusionsConfiguration.getPropertyDefinitions()).hasSize(4); } } diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/ExclusionPatternInitializerTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssueExclusionPatternInitializerTest.java similarity index 52% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/ExclusionPatternInitializerTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssueExclusionPatternInitializerTest.java index 0f9b6493e8a..fb769ec2569 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/ExclusionPatternInitializerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssueExclusionPatternInitializerTest.java @@ -18,27 +18,28 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; + +import org.sonar.batch.issue.ignore.IssueExclusionsConfiguration; +import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer; import org.junit.Before; import org.junit.Test; import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; import org.sonar.api.utils.SonarException; -import org.sonar.plugins.core.issue.ignore.IgnoreIssuesConfiguration; - import static org.fest.assertions.Assertions.assertThat; -public class ExclusionPatternInitializerTest { +public class IssueExclusionPatternInitializerTest { - private ExclusionPatternInitializer patternsInitializer; + private IssueExclusionPatternInitializer patternsInitializer; private Settings settings; @Before public void init() { - settings = new Settings(new PropertyDefinitions(IgnoreIssuesConfiguration.getPropertyDefinitions())); - patternsInitializer = new ExclusionPatternInitializer(settings); + settings = new Settings(new PropertyDefinitions(IssueExclusionsConfiguration.getPropertyDefinitions())); + patternsInitializer = new IssueExclusionPatternInitializer(settings); } @Test @@ -50,11 +51,11 @@ public class ExclusionPatternInitializerTest { @Test public void shouldHavePatternsBasedOnMulticriteriaPattern() { - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY, "1,2"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IgnoreIssuesConfiguration.RESOURCE_KEY, "org/foo/Bar.java"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IgnoreIssuesConfiguration.RULE_KEY, "*"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".2." + IgnoreIssuesConfiguration.RESOURCE_KEY, "org/foo/Hello.java"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".2." + IgnoreIssuesConfiguration.RULE_KEY, "checkstyle:MagicNumber"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY, "1,2"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IssueExclusionsConfiguration.RESOURCE_KEY, "org/foo/Bar.java"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IssueExclusionsConfiguration.RULE_KEY, "*"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".2." + IssueExclusionsConfiguration.RESOURCE_KEY, "org/foo/Hello.java"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".2." + IssueExclusionsConfiguration.RULE_KEY, "checkstyle:MagicNumber"); patternsInitializer.initPatterns(); assertThat(patternsInitializer.hasConfiguredPatterns()).isTrue(); @@ -76,29 +77,29 @@ public class ExclusionPatternInitializerTest { @Test(expected = SonarException.class) public void shouldLogInvalidResourceKey() { - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY, "1"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IgnoreIssuesConfiguration.RESOURCE_KEY, ""); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IgnoreIssuesConfiguration.RULE_KEY, "*"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY, "1"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IssueExclusionsConfiguration.RESOURCE_KEY, ""); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IssueExclusionsConfiguration.RULE_KEY, "*"); patternsInitializer.initPatterns(); } @Test(expected = SonarException.class) public void shouldLogInvalidRuleKey() { - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY, "1"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IgnoreIssuesConfiguration.RESOURCE_KEY, "*"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IgnoreIssuesConfiguration.RULE_KEY, ""); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY, "1"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IssueExclusionsConfiguration.RESOURCE_KEY, "*"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_EXCLUSION_KEY + ".1." + IssueExclusionsConfiguration.RULE_KEY, ""); patternsInitializer.initPatterns(); } @Test public void shouldReturnBlockPattern() { - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY, "1,2,3"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY + ".1." + IgnoreIssuesConfiguration.BEGIN_BLOCK_REGEXP, "// SONAR-OFF"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY + ".1." + IgnoreIssuesConfiguration.END_BLOCK_REGEXP, "// SONAR-ON"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY + ".2." + IgnoreIssuesConfiguration.BEGIN_BLOCK_REGEXP, "// FOO-OFF"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY + ".2." + IgnoreIssuesConfiguration.END_BLOCK_REGEXP, "// FOO-ON"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY + ".3." + IgnoreIssuesConfiguration.BEGIN_BLOCK_REGEXP, "// IGNORE-TO-EOF"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY + ".3." + IgnoreIssuesConfiguration.END_BLOCK_REGEXP, ""); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY, "1,2,3"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY + ".1." + IssueExclusionsConfiguration.BEGIN_BLOCK_REGEXP, "// SONAR-OFF"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY + ".1." + IssueExclusionsConfiguration.END_BLOCK_REGEXP, "// SONAR-ON"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY + ".2." + IssueExclusionsConfiguration.BEGIN_BLOCK_REGEXP, "// FOO-OFF"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY + ".2." + IssueExclusionsConfiguration.END_BLOCK_REGEXP, "// FOO-ON"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY + ".3." + IssueExclusionsConfiguration.BEGIN_BLOCK_REGEXP, "// IGNORE-TO-EOF"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY + ".3." + IssueExclusionsConfiguration.END_BLOCK_REGEXP, ""); patternsInitializer.loadFileContentPatterns(); assertThat(patternsInitializer.hasConfiguredPatterns()).isTrue(); @@ -111,17 +112,17 @@ public class ExclusionPatternInitializerTest { @Test(expected = SonarException.class) public void shouldLogInvalidStartBlockPattern() { - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY, "1"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY + ".1." + IgnoreIssuesConfiguration.BEGIN_BLOCK_REGEXP, ""); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_BLOCK_KEY + ".1." + IgnoreIssuesConfiguration.END_BLOCK_REGEXP, "// SONAR-ON"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY, "1"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY + ".1." + IssueExclusionsConfiguration.BEGIN_BLOCK_REGEXP, ""); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_BLOCK_KEY + ".1." + IssueExclusionsConfiguration.END_BLOCK_REGEXP, "// SONAR-ON"); patternsInitializer.loadFileContentPatterns(); } @Test public void shouldReturnAllFilePattern() { - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_ALLFILE_KEY, "1,2"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_ALLFILE_KEY + ".1." + IgnoreIssuesConfiguration.FILE_REGEXP, "@SONAR-IGNORE-ALL"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_ALLFILE_KEY + ".2." + IgnoreIssuesConfiguration.FILE_REGEXP, "//FOO-IGNORE-ALL"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_ALLFILE_KEY, "1,2"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_ALLFILE_KEY + ".1." + IssueExclusionsConfiguration.FILE_REGEXP, "@SONAR-IGNORE-ALL"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_ALLFILE_KEY + ".2." + IssueExclusionsConfiguration.FILE_REGEXP, "//FOO-IGNORE-ALL"); patternsInitializer.loadFileContentPatterns(); assertThat(patternsInitializer.hasConfiguredPatterns()).isTrue(); @@ -134,8 +135,8 @@ public class ExclusionPatternInitializerTest { @Test(expected = SonarException.class) public void shouldLogInvalidAllFilePattern() { - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_ALLFILE_KEY, "1"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_ALLFILE_KEY + ".1." + IgnoreIssuesConfiguration.FILE_REGEXP, ""); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_ALLFILE_KEY, "1"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_ALLFILE_KEY + ".1." + IssueExclusionsConfiguration.FILE_REGEXP, ""); patternsInitializer.loadFileContentPatterns(); } } diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/InclusionPatternInitializerTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssueInclusionPatternInitializerTest.java similarity index 64% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/InclusionPatternInitializerTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssueInclusionPatternInitializerTest.java index d277a2b30a3..59542512bfc 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/InclusionPatternInitializerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssueInclusionPatternInitializerTest.java @@ -18,26 +18,27 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; + +import org.sonar.batch.issue.ignore.IssueExclusionsConfiguration; +import org.sonar.batch.issue.ignore.pattern.IssueInclusionPatternInitializer; import org.junit.Before; import org.junit.Test; import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; -import org.sonar.plugins.core.issue.ignore.IgnoreIssuesConfiguration; - import static org.fest.assertions.Assertions.assertThat; -public class InclusionPatternInitializerTest { +public class IssueInclusionPatternInitializerTest { - private InclusionPatternInitializer patternsInitializer; + private IssueInclusionPatternInitializer patternsInitializer; private Settings settings; @Before public void init() { - settings = new Settings(new PropertyDefinitions(IgnoreIssuesConfiguration.getPropertyDefinitions())); - patternsInitializer = new InclusionPatternInitializer(settings); + settings = new Settings(new PropertyDefinitions(IssueExclusionsConfiguration.getPropertyDefinitions())); + patternsInitializer = new IssueInclusionPatternInitializer(settings); } @Test @@ -48,11 +49,11 @@ public class InclusionPatternInitializerTest { @Test public void shouldHavePatternsBasedOnMulticriteriaPattern() { - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY, "1,2"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY + ".1." + IgnoreIssuesConfiguration.RESOURCE_KEY, "org/foo/Bar.java"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY + ".1." + IgnoreIssuesConfiguration.RULE_KEY, "*"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY + ".2." + IgnoreIssuesConfiguration.RESOURCE_KEY, "org/foo/Hello.java"); - settings.setProperty(IgnoreIssuesConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY + ".2." + IgnoreIssuesConfiguration.RULE_KEY, "checkstyle:MagicNumber"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY, "1,2"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY + ".1." + IssueExclusionsConfiguration.RESOURCE_KEY, "org/foo/Bar.java"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY + ".1." + IssueExclusionsConfiguration.RULE_KEY, "*"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY + ".2." + IssueExclusionsConfiguration.RESOURCE_KEY, "org/foo/Hello.java"); + settings.setProperty(IssueExclusionsConfiguration.PATTERNS_MULTICRITERIA_INCLUSION_KEY + ".2." + IssueExclusionsConfiguration.RULE_KEY, "checkstyle:MagicNumber"); patternsInitializer.initPatterns(); assertThat(patternsInitializer.hasConfiguredPatterns()).isTrue(); diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/IssuePatternTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssuePatternTest.java similarity index 97% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/IssuePatternTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssuePatternTest.java index 9a069bbb2a1..3c9d43dfe13 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/IssuePatternTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/IssuePatternTest.java @@ -18,13 +18,14 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; + +import org.sonar.batch.issue.ignore.pattern.IssuePattern; import org.junit.Test; import org.sonar.api.issue.Issue; import org.sonar.api.rule.RuleKey; import org.sonar.api.rules.Rule; - import static org.fest.assertions.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/LineRangeTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/LineRangeTest.java similarity index 95% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/LineRangeTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/LineRangeTest.java index 3c4c02aedf4..21df72ba862 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/LineRangeTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/LineRangeTest.java @@ -18,10 +18,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; -import org.junit.Test; +import org.sonar.batch.issue.ignore.pattern.LineRange; +import org.junit.Test; import static org.fest.assertions.Assertions.assertThat; public class LineRangeTest { diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/PatternDecoderTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternDecoderTest.java similarity index 97% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/PatternDecoderTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternDecoderTest.java index 18e9e58436c..b993e82e8ff 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/PatternDecoderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternDecoderTest.java @@ -18,7 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; + +import org.sonar.batch.issue.ignore.pattern.IssuePattern; +import org.sonar.batch.issue.ignore.pattern.PatternDecoder; import org.junit.Rule; import org.junit.Test; diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/PatternMatcherTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java similarity index 93% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/PatternMatcherTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java index af7f97e9f0e..a948aac47f7 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/pattern/PatternMatcherTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java @@ -17,10 +17,14 @@ * 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.plugins.core.issue.ignore.pattern; +package org.sonar.batch.issue.ignore.pattern; -import com.google.common.collect.Sets; +import org.sonar.batch.issue.ignore.pattern.IssuePattern; +import org.sonar.batch.issue.ignore.pattern.LineRange; +import org.sonar.batch.issue.ignore.pattern.PatternDecoder; +import org.sonar.batch.issue.ignore.pattern.PatternMatcher; +import com.google.common.collect.Sets; import org.junit.Before; import org.junit.Test; import org.sonar.api.issue.Issue; diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesSourceScannerTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java similarity index 86% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesSourceScannerTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java index 5fc3a27c648..8f8eba536f7 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesSourceScannerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java @@ -18,7 +18,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.scanner; +package org.sonar.batch.issue.ignore.scanner; + +import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer; +import org.sonar.batch.issue.ignore.pattern.IssueInclusionPatternInitializer; +import org.sonar.batch.issue.ignore.pattern.PatternMatcher; +import org.sonar.batch.issue.ignore.scanner.IssueExclusionsLoader; +import org.sonar.batch.issue.ignore.scanner.IssueExclusionsRegexpScanner; import com.google.common.base.Charsets; import org.junit.Before; @@ -27,17 +33,12 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.sonar.api.resources.Project; import org.sonar.api.scan.filesystem.FileQuery; import org.sonar.api.scan.filesystem.internal.DefaultInputFile; import org.sonar.api.scan.filesystem.internal.InputFileBuilder; import org.sonar.api.utils.SonarException; import org.sonar.batch.scan.filesystem.DefaultModuleFileSystem; -import org.sonar.plugins.core.issue.ignore.pattern.ExclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.pattern.InclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.pattern.PatternMatcher; import java.io.File; import java.io.IOException; @@ -50,23 +51,21 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; -public class IgnoreIssuesSourceScannerTest { +public class IssueExclusionsLoaderTest { - private IgnoreIssuesSourceScanner scanner; + private IssueExclusionsLoader scanner; @Mock - private IgnoreIssuesRegexpScanner regexpScanner; + private IssueExclusionsRegexpScanner regexpScanner; @Mock - private InclusionPatternInitializer inclusionPatternInitializer; + private IssueInclusionPatternInitializer inclusionPatternInitializer; @Mock - private ExclusionPatternInitializer exclusionPatternInitializer; + private IssueExclusionPatternInitializer exclusionPatternInitializer; @Mock private PatternMatcher patternMatcher; @Mock private DefaultModuleFileSystem fs; - private Project project; - @Rule public ExpectedException thrown = ExpectedException.none(); @@ -80,12 +79,9 @@ public class IgnoreIssuesSourceScannerTest { baseDir = temp.newFolder(); MockitoAnnotations.initMocks(this); - Project realProject = new Project("polop"); - project = Mockito.spy(realProject); - Mockito.doReturn("java").when(project).getLanguageKey(); when(fs.sourceCharset()).thenReturn(UTF_8); - scanner = new IgnoreIssuesSourceScanner(regexpScanner, exclusionPatternInitializer, inclusionPatternInitializer, fs); + scanner = new IssueExclusionsLoader(regexpScanner, exclusionPatternInitializer, inclusionPatternInitializer, fs); } @Test @@ -127,7 +123,7 @@ public class IgnoreIssuesSourceScannerTest { when(exclusionPatternInitializer.hasFileContentPattern()).thenReturn(true); - scanner.analyse(project, null); + scanner.execute(); verify(inclusionPatternInitializer).initializePatternsForPath("src/main/java/Foo.java", "polop:src/main/java/Foo.java"); verify(inclusionPatternInitializer).initializePatternsForPath("src/test/java/FooTest.java", "polop:src/test/java/FooTest.java"); @@ -151,7 +147,7 @@ public class IgnoreIssuesSourceScannerTest { when(exclusionPatternInitializer.hasFileContentPattern()).thenReturn(false); - scanner.analyse(project, null); + scanner.execute(); verify(inclusionPatternInitializer).initializePatternsForPath("src/main/java/Foo.java", "polop:src/main/java/Foo.java"); verify(inclusionPatternInitializer).initializePatternsForPath("src/test/java/FooTest.java", "polop:src/test/java/FooTest.java"); @@ -174,6 +170,6 @@ public class IgnoreIssuesSourceScannerTest { thrown.expect(SonarException.class); thrown.expectMessage("Unable to read the source file"); - scanner.analyse(project, null); + scanner.execute(); } } diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java similarity index 90% rename from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest.java rename to sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java index bfbe6c6aee0..d50c3778e32 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java @@ -18,17 +18,19 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.core.issue.ignore.scanner; +package org.sonar.batch.issue.ignore.scanner; + +import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer; +import org.sonar.batch.issue.ignore.pattern.IssuePattern; +import org.sonar.batch.issue.ignore.pattern.LineRange; +import org.sonar.batch.issue.ignore.pattern.PatternMatcher; +import org.sonar.batch.issue.ignore.scanner.IssueExclusionsRegexpScanner; import com.google.common.collect.Sets; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.sonar.plugins.core.issue.ignore.pattern.ExclusionPatternInitializer; -import org.sonar.plugins.core.issue.ignore.pattern.IssuePattern; -import org.sonar.plugins.core.issue.ignore.pattern.LineRange; -import org.sonar.plugins.core.issue.ignore.pattern.PatternMatcher; import org.sonar.test.TestUtils; import java.io.IOException; @@ -41,13 +43,13 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -public class IgnoreIssuesRegexpScannerTest { +public class IssueExclusionsRegexpScannerTest { - private IgnoreIssuesRegexpScanner regexpScanner; + private IssueExclusionsRegexpScanner regexpScanner; private String javaFile; @Mock - private ExclusionPatternInitializer patternsInitializer; + private IssueExclusionPatternInitializer patternsInitializer; @Mock private PatternMatcher patternMatcher; @Mock @@ -70,7 +72,7 @@ public class IgnoreIssuesRegexpScannerTest { when(patternsInitializer.getBlockPatterns()).thenReturn(Arrays.asList(blockPattern1, blockPattern2)); when(patternsInitializer.getPatternMatcher()).thenReturn(patternMatcher); - regexpScanner = new IgnoreIssuesRegexpScanner(patternsInitializer); + regexpScanner = new IssueExclusionsRegexpScanner(patternsInitializer); verify(patternsInitializer, times(1)).getAllFilePatterns(); verify(patternsInitializer, times(1)).getBlockPatterns(); diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-double-regexp-mess.txt b/sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-double-regexp-mess.txt similarity index 100% rename from plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-double-regexp-mess.txt rename to sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-double-regexp-mess.txt diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-double-regexp-twice.txt b/sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-double-regexp-twice.txt similarity index 100% rename from plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-double-regexp-twice.txt rename to sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-double-regexp-twice.txt diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-double-regexp-unfinished.txt b/sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-double-regexp-unfinished.txt similarity index 100% rename from plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-double-regexp-unfinished.txt rename to sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-double-regexp-unfinished.txt diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-double-regexp-wrong-order.txt b/sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-double-regexp-wrong-order.txt similarity index 100% rename from plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-double-regexp-wrong-order.txt rename to sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-double-regexp-wrong-order.txt diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-double-regexp.txt b/sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-double-regexp.txt similarity index 100% rename from plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-double-regexp.txt rename to sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-double-regexp.txt diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-no-regexp.txt b/sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-no-regexp.txt similarity index 100% rename from plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-no-regexp.txt rename to sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-no-regexp.txt diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-single-regexp-and-double-regexp.txt b/sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-single-regexp-and-double-regexp.txt similarity index 100% rename from plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-single-regexp-and-double-regexp.txt rename to sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-single-regexp-and-double-regexp.txt diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-single-regexp.txt b/sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-single-regexp.txt similarity index 100% rename from plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/ignore/scanner/IgnoreIssuesRegexpScannerTest/file-with-single-regexp.txt rename to sonar-batch/src/test/resources/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScannerTest/file-with-single-regexp.txt -- 2.39.5