use of org.sonarsource.sonarlint.core.client.api.standalone.StandaloneGlobalConfiguration in project sonar-java by SonarSource.
the class SonarLintTest method prepare.
@BeforeClass
public static void prepare() throws Exception {
StandaloneGlobalConfiguration config = StandaloneGlobalConfiguration.builder().addPlugin(JavaTestSuite.JAVA_PLUGIN_LOCATION.getFile().toURI().toURL()).setSonarLintUserHome(temp.newFolder().toPath()).setLogOutput((formattedMessage, level) -> {
/* Don't pollute logs*/
}).build();
sonarlintEngine = new StandaloneSonarLintEngineImpl(config);
baseDir = temp.newFolder();
}
use of org.sonarsource.sonarlint.core.client.api.standalone.StandaloneGlobalConfiguration in project sonarlint-intellij by SonarSource.
the class StandaloneTest method prepare.
@BeforeClass
public static void prepare() throws Exception {
StandaloneGlobalConfiguration config = StandaloneGlobalConfiguration.builder().addPlugins(getPlugins(PLUGINS_FOLDER).toArray(new URL[0])).setSonarLintUserHome(temp.newFolder("sonarlint").toPath()).setLogOutput((msg, level) -> System.out.println("[" + level + "]: " + msg)).build();
sonarlintEngine = new StandaloneSonarLintEngineImpl(config);
baseDir = temp.newFolder();
}
use of org.sonarsource.sonarlint.core.client.api.standalone.StandaloneGlobalConfiguration in project sonarlint-core by SonarSource.
the class StandaloneIssueMediumTest method prepare.
@BeforeClass
public static void prepare() throws Exception {
Path sonarlintUserHome = temp.newFolder().toPath();
Path fakeTypeScriptProjectPath = temp.newFolder().toPath();
Path packagejson = fakeTypeScriptProjectPath.resolve("package.json");
FileUtils.write(packagejson.toFile(), "{" + "\"devDependencies\": {\n" + " \"typescript\": \"2.6.1\"\n" + " }" + "}", StandardCharsets.UTF_8);
ProcessBuilder pb = new ProcessBuilder("npm" + (SystemUtils.IS_OS_WINDOWS ? ".cmd" : ""), "install").directory(fakeTypeScriptProjectPath.toFile()).inheritIO();
Process process = pb.start();
if (process.waitFor() != 0) {
fail("Unable to run npm install");
}
Map<String, String> extraProperties = new HashMap<>();
extraProperties.put("sonar.typescript.internal.typescriptLocation", fakeTypeScriptProjectPath.resolve("node_modules").toString());
StandaloneGlobalConfiguration config = StandaloneGlobalConfiguration.builder().addPlugin(PluginLocator.getJavaScriptPluginUrl()).addPlugin(PluginLocator.getJavaPluginUrl()).addPlugin(PluginLocator.getPhpPluginUrl()).addPlugin(PluginLocator.getPythonPluginUrl()).addPlugin(PluginLocator.getCppPluginUrl()).addPlugin(PluginLocator.getXooPluginUrl()).addPlugin(PluginLocator.getLicensePluginUrl()).addPlugin(PluginLocator.getTypeScriptPluginUrl()).setSonarLintUserHome(sonarlintUserHome).setLogOutput((msg, level) -> System.out.println(msg)).setExtraProperties(extraProperties).build();
sonarlint = new StandaloneSonarLintEngineImpl(config);
}
use of org.sonarsource.sonarlint.core.client.api.standalone.StandaloneGlobalConfiguration in project sonarlint-core by SonarSource.
the class StandaloneTest method prepare.
@BeforeClass
public static void prepare() throws Exception {
Path sonarlintUserHome = temp.newFolder().toPath();
logs = new ArrayList<>();
Map<String, String> globalProps = new HashMap<>();
globalProps.put("sonar.global.label", "It works");
StandaloneGlobalConfiguration config = StandaloneGlobalConfiguration.builder().addPlugin(new File("../plugins/global-extension-plugin/target/global-extension-plugin.jar").toURI().toURL()).setSonarLintUserHome(sonarlintUserHome).setLogOutput((msg, level) -> logs.add(msg)).setExtraProperties(globalProps).build();
sonarlint = new StandaloneSonarLintEngineImpl(config);
assertThat(logs).containsOnlyOnce("Start Global Extension It works");
}
use of org.sonarsource.sonarlint.core.client.api.standalone.StandaloneGlobalConfiguration in project sonar-web by SonarSource.
the class SonarLintTest method prepare.
@BeforeClass
public static void prepare() throws Exception {
StandaloneGlobalConfiguration sonarLintConfig = StandaloneGlobalConfiguration.builder().addPlugin(FileLocation.byWildcardMavenFilename(new File("../../sonar-web-plugin/target"), "sonar-web-plugin-*.jar").getFile().toURI().toURL()).setSonarLintUserHome(temp.newFolder().toPath()).setLogOutput((formattedMessage, level) -> {
/* Don't pollute logs */
}).build();
sonarlintEngine = new StandaloneSonarLintEngineImpl(sonarLintConfig);
baseDir = temp.newFolder();
}
Aggregations