Skip to content

Commit 022c59b

Browse files
author
Alexey Sosnoviy
committed
subsystemFilter
1 parent bdfce33 commit 022c59b

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCommunityProperties.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public final class BSLCommunityProperties {
4141
public static final String LANG_SERVER_CONFIGURATION_PATH_KEY = "sonar.bsl.languageserver.configurationPath";
4242
public static final String LANG_SERVER_OVERRIDE_CONFIGURATION_KEY = "sonar.bsl.languageserver.overrideConfiguration";
4343
public static final String LANG_SERVER_REPORT_PATH_KEY = "sonar.bsl.languageserver.reportPaths";
44+
public static final String LANG_SERVER_SUBSYSTEM_FILTER_INCLUDE_KEY = "sonar.bsl.languageserver.subsystemsFilter.include";
45+
public static final String LANG_SERVER_SUBSYSTEM_FILTER_EXCLUDE_KEY = "sonar.bsl.languageserver.subsystemsFilter.exclude";
4446
public static final String BSL_FILE_EXTENSIONS_KEY = "sonar.bsl.file.suffixes";
4547

4648
public static final Boolean LANG_SERVER_ENABLED_DEFAULT_VALUE = Boolean.TRUE;
@@ -96,6 +98,20 @@ public static List<PropertyDefinition> getProperties() {
9698
.onQualifiers(Qualifiers.PROJECT)
9799
.build(),
98100
PropertyDefinitionUtils.newPropertyBuilderBSL(4,
101+
LANG_SERVER_SUBSYSTEM_FILTER_INCLUDE_KEY,
102+
"subsystemfilter.include",
103+
"")
104+
.onQualifiers(Qualifiers.PROJECT)
105+
.multiValues(true)
106+
.build(),
107+
PropertyDefinitionUtils.newPropertyBuilderBSL(5,
108+
LANG_SERVER_SUBSYSTEM_FILTER_EXCLUDE_KEY,
109+
"subsystemfilter.exclude",
110+
"")
111+
.onQualifiers(Qualifiers.PROJECT)
112+
.multiValues(true)
113+
.build(),
114+
PropertyDefinitionUtils.newPropertyBuilderBSL(7,
99115
LANG_SERVER_CONFIGURATION_PATH_KEY,
100116
"enabled.configurationPath",
101117
LANG_SERVER_CONFIGURATION_PATH_DEFAULT_VALUE)

src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,19 @@ private LanguageServerConfiguration getLanguageServerConfiguration() {
328328

329329
configuration.getDiagnosticsOptions().setSkipSupport(skipSupport);
330330

331+
332+
Set<String> includeSubsystems = new HashSet<>();
333+
Collections.addAll(includeSubsystems, context.config()
334+
.getStringArray(BSLCommunityProperties.LANG_SERVER_SUBSYSTEM_FILTER_INCLUDE_KEY));
335+
336+
configuration.getDiagnosticsOptions().getSubsystemsFilter().setInclude(includeSubsystems);
337+
338+
Set<String> excludeSubsystems = new HashSet<>();
339+
Collections.addAll(excludeSubsystems, context.config()
340+
.getStringArray(BSLCommunityProperties.LANG_SERVER_SUBSYSTEM_FILTER_EXCLUDE_KEY));
341+
342+
configuration.getDiagnosticsOptions().getSubsystemsFilter().setExclude(excludeSubsystems);
343+
331344
var activeRules = context.activeRules();
332345

333346
Map<String, Either<Boolean, Map<String, Object>>> diagnostics = new HashMap<>();

src/main/resources/org/sonar/l10n/communitybsl.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ communitybsl.overrideConfiguration.name=BSL Language Server - Use configuration
1010
communitybsl.overrideConfiguration.description=Override SonarQube settings with BSL LS configuration file.
1111
communitybsl.file.suffixes.name=BSL File suffixes
1212
communitybsl.file.suffixes.description=List of file suffixes that will be scanned.
13+
communitybsl.subsystemfilter.include.description=List of subsystems for include.
14+
communitybsl.subsystemfilter.include.name=Subsystems for include.
15+
communitybsl.subsystemfilter.exclude.description=List of subsystems for exclude.
16+
communitybsl.subsystemfilter.exclude.name=List of subsystems for exclude.
1317
# EXTERNAL
1418
communitybsl.reportPaths.name=BSL Language Server Report Files
1519
communitybsl.reportPaths.description=Paths (absolute or relative) to xml files with BSL Language Server diagnostics

src/main/resources/org/sonar/l10n/communitybsl_ru.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ communitybsl.overrideConfiguration.name=Использовать конфигу
1010
communitybsl.overrideConfiguration.description=Переопределяет настройки профиля SonarQube в соответствии с конфигурационным файлом BSL Language Server
1111
communitybsl.file.suffixes.name=Расширения bsl-файлов
1212
communitybsl.file.suffixes.description=Список расширений файлов для анализа
13+
communitybsl.subsystemfilter.include.description=Список подсистем для замечаний
14+
communitybsl.subsystemfilter.include.name=Включая подсистемы
15+
communitybsl.subsystemfilter.exclude.description=Список подсистем для исключения замечаний
16+
communitybsl.subsystemfilter.exclude.name=Исключая подсистемы
1317
# EXTERNAL
1418
communitybsl.reportPaths.name=Путь к файлам отчета BSL Language Server
1519
communitybsl.reportPaths.description=Путь (абсолютный или относительный) к xml-файлам отчета BSL Language Server

src/test/java/com/github/_1c_syntax/bsl/sonar/BSLPluginTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void testGetExtensions() {
5050
var runtime = SonarRuntimeImpl.forSonarQube(VERSION_8_9, SonarQubeSide.SCANNER, SonarEdition.COMMUNITY);
5151
var context = new Plugin.Context(runtime);
5252
bslPlugin.define(context);
53-
assertThat((List<?>) context.getExtensions()).hasSize(23);
53+
assertThat((List<?>) context.getExtensions()).hasSize(25);
5454
}
5555

5656
@Test

0 commit comments

Comments
 (0)