From cc9d2163a0feb24e4139db55bb616368122a18d4 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Mon, 26 Nov 2018 16:36:06 +0100 Subject: SONAR-11508, SONAR-11484 Index files at project level --- .../main/java/org/sonar/api/batch/fs/InputFileFilter.java | 3 ++- .../java/org/sonar/api/batch/fs/internal/FileMetadata.java | 4 ---- .../java/org/sonar/api/scan/filesystem/FileExclusions.java | 13 +++++++------ 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'sonar-plugin-api') diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java index 49d6ceee2dc..4535e465247 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java @@ -20,12 +20,13 @@ package org.sonar.api.batch.fs; import org.sonar.api.ExtensionPoint; -import org.sonar.api.batch.ScannerSide; +import org.sonar.api.scanner.ScannerSide; import org.sonarsource.api.sonarlint.SonarLintSide; /** * Extension point to exclude some files from inspection * @since 4.2 + * @since 7.6 evaluated at project level */ @ScannerSide @SonarLintSide diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java index 3b52498ceaf..bda14d89d4b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java @@ -26,11 +26,8 @@ import java.io.InputStreamReader; import java.io.Reader; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; - import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; - -import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.internal.charhandler.CharHandler; import org.sonar.api.batch.fs.internal.charhandler.FileHashComputer; @@ -42,7 +39,6 @@ import org.sonar.api.batch.fs.internal.charhandler.LineOffsetCounter; * Computes hash of files. Ends of Lines are ignored, so files with * same content but different EOL encoding have the same hash. */ -@ScannerSide @Immutable public class FileMetadata { private static final char LINE_FEED = '\n'; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java index e98b77161d4..35753e14fce 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java @@ -37,10 +37,11 @@ import org.sonar.api.config.Configuration; @Deprecated @ScannerSide public class FileExclusions { - private final Configuration settings; - public FileExclusions(Configuration settings) { - this.settings = settings; + private final Configuration config; + + public FileExclusions(Configuration config) { + this.config = config; } public String[] sourceInclusions() { @@ -52,7 +53,7 @@ public class FileExclusions { } private String[] inclusions(String propertyKey) { - return Arrays.stream(settings.getStringArray(propertyKey)) + return Arrays.stream(config.getStringArray(propertyKey)) .map(StringUtils::trim) .filter(s -> !"**/*".equals(s)) .filter(s -> !"file:**/*".equals(s)) @@ -68,8 +69,8 @@ public class FileExclusions { } private String[] exclusions(String globalExclusionsProperty, String exclusionsProperty) { - String[] globalExclusions = settings.getStringArray(globalExclusionsProperty); - String[] exclusions = settings.getStringArray(exclusionsProperty); + String[] globalExclusions = config.getStringArray(globalExclusionsProperty); + String[] exclusions = config.getStringArray(exclusionsProperty); return Stream.concat(Arrays.stream(globalExclusions), Arrays.stream(exclusions)) .map(StringUtils::trim) .toArray(String[]::new); -- cgit v1.2.3