use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedAnalysisConfiguration in project sonarlint-core by SonarSource.
the class ConnectedIssueMediumTest method emptyQPJava.
@Test
public void emptyQPJava() throws IOException {
ClientInputFile inputFile = prepareJavaInputFile();
final List<Issue> issues = new ArrayList<>();
sonarlint.analyze(new ConnectedAnalysisConfiguration("test-project", baseDir.toPath(), temp.newFolder().toPath(), Arrays.asList(inputFile), ImmutableMap.<String, String>of()), new StoreIssueListener(issues), null, null);
assertThat(issues).isEmpty();
}
use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedAnalysisConfiguration in project sonarlint-core by SonarSource.
the class ConnectedIssueMediumTest method simpleJavaTestUnbinded.
@Test
public void simpleJavaTestUnbinded() throws Exception {
ClientInputFile inputFile = prepareJavaTestInputFile();
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:S2187", 1, inputFile.getPath(), "MAJOR"));
}
use of org.sonarsource.sonarlint.core.client.api.connected.ConnectedAnalysisConfiguration in project sonarlint-core by SonarSource.
the class ConnectedIssueMediumTest method simpleJavaScriptUnbinded.
@Test
public void simpleJavaScriptUnbinded() throws Exception {
String ruleKey = "javascript:UnusedVariable";
RuleDetails ruleDetails = sonarlint.getRuleDetails(ruleKey);
assertThat(ruleDetails.getKey()).isEqualTo(ruleKey);
assertThat(ruleDetails.getName()).isEqualTo("Unused local variables should be removed");
assertThat(ruleDetails.getLanguage()).isEqualTo("js");
assertThat(ruleDetails.getSeverity()).isEqualTo("MAJOR");
assertThat(ruleDetails.getHtmlDescription()).contains("<p>", "If a local variable is declared but not used");
assertThat(ruleDetails.getExtendedDescription()).isEmpty();
ClientInputFile inputFile = prepareInputFile("foo.js", "function foo() {\n" + " var x;\n" + " var y; //NOSONAR\n" + "}", false);
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").containsOnly(tuple(ruleKey, 2, inputFile.getPath()));
}
Aggregations