Search in sources :

Example 1 with ConfigurationBridge

use of org.sonar.api.config.internal.ConfigurationBridge in project sonarlint-core by SonarSource.

the class StorageFileExclusions method getExcludedFiles.

public Set<String> getExcludedFiles(String moduleKey, Collection<String> filePaths, Predicate<String> testFilePredicate) {
    GlobalProperties globalProps = storageReader.readGlobalProperties();
    ModuleConfiguration moduleConfig = storageReader.readModuleConfig(moduleKey);
    MapSettings settings = new MapSettings();
    settings.addProperties(globalProps.getProperties());
    settings.addProperties(moduleConfig.getProperties());
    ExclusionFilters exclusionFilters = new ExclusionFilters(new ConfigurationBridge(settings));
    exclusionFilters.prepare();
    return filePaths.stream().filter(filePath -> !exclusionFilters.accept(filePath, testFilePredicate.test(filePath) ? Type.TEST : Type.MAIN)).collect(Collectors.toSet());
}
Also used : GlobalProperties(org.sonarsource.sonarlint.core.proto.Sonarlint.GlobalProperties) Predicate(java.util.function.Predicate) Collection(java.util.Collection) Set(java.util.Set) Type(org.sonar.api.batch.fs.InputFile.Type) ConfigurationBridge(org.sonar.api.config.internal.ConfigurationBridge) ModuleConfiguration(org.sonarsource.sonarlint.core.proto.Sonarlint.ModuleConfiguration) MapSettings(org.sonar.api.config.internal.MapSettings) Collectors(java.util.stream.Collectors) ExclusionFilters(org.sonarsource.sonarlint.core.container.analysis.ExclusionFilters) ModuleConfiguration(org.sonarsource.sonarlint.core.proto.Sonarlint.ModuleConfiguration) GlobalProperties(org.sonarsource.sonarlint.core.proto.Sonarlint.GlobalProperties) MapSettings(org.sonar.api.config.internal.MapSettings) ExclusionFilters(org.sonarsource.sonarlint.core.container.analysis.ExclusionFilters) ConfigurationBridge(org.sonar.api.config.internal.ConfigurationBridge)

Aggregations

Collection (java.util.Collection)1 Set (java.util.Set)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 Type (org.sonar.api.batch.fs.InputFile.Type)1 ConfigurationBridge (org.sonar.api.config.internal.ConfigurationBridge)1 MapSettings (org.sonar.api.config.internal.MapSettings)1 ExclusionFilters (org.sonarsource.sonarlint.core.container.analysis.ExclusionFilters)1 GlobalProperties (org.sonarsource.sonarlint.core.proto.Sonarlint.GlobalProperties)1 ModuleConfiguration (org.sonarsource.sonarlint.core.proto.Sonarlint.ModuleConfiguration)1