use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedAnalysisConfiguration in project sonarlint-core by SonarSource.
the class AbstractConnectedTest method createAnalysisConfiguration.
protected ConnectedAnalysisConfiguration createAnalysisConfiguration(String projectKey, String projectDir, String filePath, String... properties) throws IOException {
final Path baseDir = Paths.get("projects/" + projectDir).toAbsolutePath();
final Path path = baseDir.resolve(filePath);
return new ConnectedAnalysisConfiguration(projectKey, new File("projects/" + projectDir).toPath().toAbsolutePath(), t.newFolder().toPath(), Collections.singletonList(new TestClientInputFile(baseDir, path, false, StandardCharsets.UTF_8)), toMap(properties));
}
use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedAnalysisConfiguration in project sonarlint-core by SonarSource.
the class ConnectedIssueExclusionsMediumTest method collectIssues.
private List<Issue> collectIssues(ClientInputFile inputFile1, ClientInputFile inputFile2) throws IOException {
final List<Issue> issues = new ArrayList<>();
sonarlint.analyze(new ConnectedAnalysisConfiguration(JAVA_MODULE_KEY, baseDir.toPath(), temp.newFolder().toPath(), Arrays.asList(inputFile1, inputFile2), ImmutableMap.<String, String>of()), new StoreIssueListener(issues), null, null);
return issues;
}
use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedAnalysisConfiguration in project sonarlint-core by SonarSource.
the class ConnectedIssueMediumTest method simpleJavaUnbinded.
@Test
public void simpleJavaUnbinded() throws Exception {
ClientInputFile inputFile = prepareJavaInputFile();
final List<Issue> issues = new ArrayList<>();
sonarlint.analyze(new ConnectedAnalysisConfiguration(null, baseDir.toPath(), temp.newFolder().toPath(), Arrays.asList(inputFile), ImmutableMap.<String, String>of()), new StoreIssueListener(issues), null, null);
assertThat(issues).extracting("ruleKey", "startLine", "inputFile.path", "severity").containsOnly(tuple("squid:S106", 4, inputFile.getPath(), "MAJOR"), tuple("squid:S1220", null, inputFile.getPath(), "MINOR"), tuple("squid:S1481", 3, inputFile.getPath(), "MAJOR"));
}
use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedAnalysisConfiguration in project sonarlint-core by SonarSource.
the class ConnectedIssueMediumTest method testStaleModule.
@Test
public void testStaleModule() throws IOException {
assertThat(sonarlint.getModuleStorageStatus("stale_module").isStale()).isTrue();
ConnectedAnalysisConfiguration config = new ConnectedAnalysisConfiguration("stale_module", baseDir.toPath(), temp.newFolder().toPath(), Collections.<ClientInputFile>emptyList(), ImmutableMap.<String, String>of());
try {
sonarlint.analyze(config, createNoOpIssueListener(), null, null);
fail("Expected exception");
} catch (Exception e) {
assertThat(e).isInstanceOf(StorageException.class).hasMessage("Stored data for module 'stale_module' is stale because it was created with a different version of SonarLint. Please update the binding.");
}
}
use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedAnalysisConfiguration in project sonarlint-core by SonarSource.
the class ConnectedIssueMediumTest method simpleJavaBinded.
@Test
public void simpleJavaBinded() throws Exception {
ClientInputFile inputFile = prepareJavaInputFile();
final List<Issue> issues = new ArrayList<>();
sonarlint.analyze(new ConnectedAnalysisConfiguration(JAVA_MODULE_KEY, baseDir.toPath(), temp.newFolder().toPath(), Arrays.asList(inputFile), ImmutableMap.<String, String>of()), new StoreIssueListener(issues), null, null);
assertThat(issues).extracting("ruleKey", "startLine", "inputFile.path", "severity").containsOnly(tuple("squid:S106", 4, inputFile.getPath(), "MAJOR"), tuple("squid:S1220", null, inputFile.getPath(), "MINOR"), tuple("squid:S1481", 3, inputFile.getPath(), "MAJOR"));
}
Aggregations