Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subsystemFilter #334

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public final class BSLCommunityProperties {
public static final String LANG_SERVER_CONFIGURATION_PATH_KEY = "sonar.bsl.languageserver.configurationPath";
public static final String LANG_SERVER_OVERRIDE_CONFIGURATION_KEY = "sonar.bsl.languageserver.overrideConfiguration";
public static final String LANG_SERVER_REPORT_PATH_KEY = "sonar.bsl.languageserver.reportPaths";
public static final String LANG_SERVER_SUBSYSTEM_FILTER_INCLUDE_KEY = "sonar.bsl.languageserver.subsystemsFilter.include";
public static final String LANG_SERVER_SUBSYSTEM_FILTER_EXCLUDE_KEY = "sonar.bsl.languageserver.subsystemsFilter.exclude";
public static final String BSL_FILE_EXTENSIONS_KEY = "sonar.bsl.file.suffixes";

public static final Boolean LANG_SERVER_ENABLED_DEFAULT_VALUE = Boolean.TRUE;
Expand Down Expand Up @@ -96,6 +98,20 @@ public static List<PropertyDefinition> getProperties() {
.onQualifiers(Qualifiers.PROJECT)
.build(),
PropertyDefinitionUtils.newPropertyBuilderBSL(4,
LANG_SERVER_SUBSYSTEM_FILTER_INCLUDE_KEY,
"subsystemfilter.include",
"")
.onQualifiers(Qualifiers.PROJECT)
.multiValues(true)
.build(),
PropertyDefinitionUtils.newPropertyBuilderBSL(5,
LANG_SERVER_SUBSYSTEM_FILTER_EXCLUDE_KEY,
"subsystemfilter.exclude",
"")
.onQualifiers(Qualifiers.PROJECT)
.multiValues(true)
.build(),
PropertyDefinitionUtils.newPropertyBuilderBSL(7,
LANG_SERVER_CONFIGURATION_PATH_KEY,
"enabled.configurationPath",
LANG_SERVER_CONFIGURATION_PATH_DEFAULT_VALUE)
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,19 @@ private LanguageServerConfiguration getLanguageServerConfiguration() {

configuration.getDiagnosticsOptions().setSkipSupport(skipSupport);


Set<String> includeSubsystems = new HashSet<>();
Collections.addAll(includeSubsystems, context.config()
.getStringArray(BSLCommunityProperties.LANG_SERVER_SUBSYSTEM_FILTER_INCLUDE_KEY));

configuration.getDiagnosticsOptions().getSubsystemsFilter().setInclude(includeSubsystems);

Set<String> excludeSubsystems = new HashSet<>();
Collections.addAll(excludeSubsystems, context.config()
.getStringArray(BSLCommunityProperties.LANG_SERVER_SUBSYSTEM_FILTER_EXCLUDE_KEY));

configuration.getDiagnosticsOptions().getSubsystemsFilter().setExclude(excludeSubsystems);

var activeRules = context.activeRules();

Map<String, Either<Boolean, Map<String, Object>>> diagnostics = new HashMap<>();
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/org/sonar/l10n/communitybsl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ communitybsl.overrideConfiguration.name=BSL Language Server - Use configuration
communitybsl.overrideConfiguration.description=Override SonarQube settings with BSL LS configuration file.
communitybsl.file.suffixes.name=BSL File suffixes
communitybsl.file.suffixes.description=List of file suffixes that will be scanned.
communitybsl.subsystemfilter.include.description=List of subsystems for include.
communitybsl.subsystemfilter.include.name=Subsystems for include.
communitybsl.subsystemfilter.exclude.description=List of subsystems for exclude.
communitybsl.subsystemfilter.exclude.name=List of subsystems for exclude.
# EXTERNAL
communitybsl.reportPaths.name=BSL Language Server Report Files
communitybsl.reportPaths.description=Paths (absolute or relative) to xml files with BSL Language Server diagnostics
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/org/sonar/l10n/communitybsl_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ communitybsl.overrideConfiguration.name=Использовать конфигу
communitybsl.overrideConfiguration.description=Переопределяет настройки профиля SonarQube в соответствии с конфигурационным файлом BSL Language Server
communitybsl.file.suffixes.name=Расширения bsl-файлов
communitybsl.file.suffixes.description=Список расширений файлов для анализа
communitybsl.subsystemfilter.include.description=Список подсистем для замечаний
communitybsl.subsystemfilter.include.name=Включая подсистемы
communitybsl.subsystemfilter.exclude.description=Список подсистем для исключения замечаний
communitybsl.subsystemfilter.exclude.name=Исключая подсистемы
# EXTERNAL
communitybsl.reportPaths.name=Путь к файлам отчета BSL Language Server
communitybsl.reportPaths.description=Путь (абсолютный или относительный) к xml-файлам отчета BSL Language Server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void testGetExtensions() {
var runtime = SonarRuntimeImpl.forSonarQube(VERSION_8_9, SonarQubeSide.SCANNER, SonarEdition.COMMUNITY);
var context = new Plugin.Context(runtime);
bslPlugin.define(context);
assertThat((List<?>) context.getExtensions()).hasSize(23);
assertThat((List<?>) context.getExtensions()).hasSize(25);
}

@Test
Expand Down