Skip to content

Commit

Permalink
SLCORE-672 remove explicit dependency check for DBD plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
sophio-japharidze-sonarsource committed May 30, 2024
1 parent 7c9c130 commit e2fa6ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,9 @@ private static PluginRequirementsCheckResult checkUnsatisfiedPluginDependency(Pl
if (basePluginKey != null && checkForPluginSkipped(currentResultsByKey.get(basePluginKey))) {
return processUnsatisfiedDependency(currentResult.getPlugin(), basePluginKey);
}
if (DataflowBugDetection.PLUGIN_ALLOW_LIST.contains(plugin.getKey())) {
// Workaround for SLCORE-667
// dbd and dbdpythonfrontend require Python to be working
if (!enableDataflowBugDetection) {
if (DataflowBugDetection.PLUGIN_ALLOW_LIST.contains(plugin.getKey()) && !enableDataflowBugDetection) {
LOG.debug("DBD feature disabled. Skip loading plugin '{}'.", plugin.getName());
return new PluginRequirementsCheckResult(plugin, SkipReason.UnsupportedFeature.INSTANCE);
}
var pythonPluginResult = currentResultsByKey.get(SonarLanguage.PYTHON.getPluginKey());
if (checkForPluginSkipped(pythonPluginResult)) {
return processUnsatisfiedDependency(currentResult.getPlugin(), SonarLanguage.PYTHON.getPluginKey());
}
}
return currentResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,11 @@ void load_plugin_skip_plugins_having_unsatisfied_python_frontend_dbd(@TempDir Pa
assertThat(logsWithoutStartStop()).contains("DBD feature disabled. Skip loading plugin 'dbdpythonfrontend'.");
}


@Test
void load_plugin_skip_plugins_having_unsatisfied_python_dbd(@TempDir Path storage) throws IOException {
var fakePlugin = fakePlugin(storage, "fake.jar",
path -> createPluginManifest(path, "dbd", V1_0));
path -> createPluginManifest(path, "dbd", V1_0, withRequiredPlugins("python:1.15")));
Set<Path> jars = Set.of(fakePlugin);

var loadedPlugins = underTest.checkRequirements(jars, NONE, null, Optional.empty(), true);
Expand All @@ -403,6 +404,18 @@ void load_plugin_skip_plugins_having_unsatisfied_python_dbd(@TempDir Path storag
assertThat(logsWithoutStartStop()).contains("Plugin 'dbd' dependency on 'python' is unsatisfied. Skip loading it.");
}

@Test
void load_plugin_skip_plugins_having_unsatisfied_java_dbd(@TempDir Path storage) throws IOException {
var fakePlugin = fakePlugin(storage, "fake.jar",
path -> createPluginManifest(path, "dbd", V1_0, withRequiredPlugins("java:7.35")));
Set<Path> jars = Set.of(fakePlugin);

var loadedPlugins = underTest.checkRequirements(jars, NONE, null, Optional.empty(), true);

assertThat(loadedPlugins.values()).extracting(r -> r.getPlugin().getKey(), PluginRequirementsCheckResult::isSkipped, p -> p.getSkipReason().orElse(null))
.containsOnly(tuple("dbd", true, new SkipReason.UnsatisfiedDependency(SonarLanguage.JAVA.getPluginKey())));
assertThat(logsWithoutStartStop()).contains("Plugin 'dbd' dependency on 'java' is unsatisfied. Skip loading it.");
}
@Test
void load_plugin_having_satisfied_python_frontend_dbd(@TempDir Path storage) throws IOException {
var fakePlugin = fakePlugin(storage, "fake.jar",
Expand Down

0 comments on commit e2fa6ff

Please sign in to comment.