当前位置: 首页>>代码示例>>Java>>正文


Java IssueQuery类代码示例

本文整理汇总了Java中org.sonar.wsclient.issue.IssueQuery的典型用法代码示例。如果您正苦于以下问题:Java IssueQuery类的具体用法?Java IssueQuery怎么用?Java IssueQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IssueQuery类属于org.sonar.wsclient.issue包,在下文中一共展示了IssueQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test_report_path

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void test_report_path() {
  SonarRunner build = SonarRunner.create()
    .setProjectDir(new File("projects/Csharp/"))
    .setProjectKey(PROJECT_KEY)
    .setProjectName(PROJECT_KEY)
    .setProjectVersion("1.0")
    .setSourceDirs(".")
    .setProperty("sonar.modules", "Csharp")
    .setProperty(Tests.SOLUTION_FILE_PROPERTY_KEY, "Csharp.sln")
    .setProperty("sonar.resharper.cs.reportPath", "report/report.xml")
    .setProperty("sonar.sourceEncoding", "UTF-8")
    .setProfile("csharp-it-profile");

  orchestrator.executeBuild(build);

  List<Issue> issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create()).list();

  assertThat(issues).hasSize(1);
  assertThat(issues.get(0).ruleKey()).isEqualTo("resharper-cs:UnusedVariable.Compiler");
  assertThat(issues.get(0).componentKey()).isEqualTo(FILE_KEY);
}
 
开发者ID:GregBartlett,项目名称:sonar-resharper,代码行数:23,代码来源:CSharpTest.java

示例2: test_report_path

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void test_report_path() {
  SonarRunner build = SonarRunner.create()
    .setProjectDir(new File("projects/VBNet/"))
    .setProjectKey(PROJECT_KEY)
    .setProjectName(PROJECT_KEY)
    .setProjectVersion("1.0")
    .setSourceDirs(".")
    .setProperty("sonar.modules", "VBNet")
    .setProperty(Tests.SOLUTION_FILE_PROPERTY_KEY, "VBNet.sln")
    .setProperty("sonar.resharper.vbnet.reportPath", "report/report.xml")
    .setProperty("sonar.sourceEncoding", "UTF-8")
    .setProfile("vbnet-it-profile");

  orchestrator.executeBuild(build);

  List<Issue> issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create()).list();

  assertThat(issues).hasSize(1);
  assertThat(issues.get(0).ruleKey()).isEqualTo("resharper-vbnet:UnusedVariable");
  assertThat(issues.get(0).componentKey()).isEqualTo(FILE_KEY);
}
 
开发者ID:GregBartlett,项目名称:sonar-resharper,代码行数:23,代码来源:VBNetTest.java

示例3: test

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void test() {
  String ruleKey = "schemaCheck1";
  createAndActivateRuleFromTemplate(ruleKey);

  orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY);
  orchestrator.getServer().associateProjectToQualityProfile(PROJECT_KEY, "xml", "empty");
  orchestrator.executeBuild(XmlTestSuite.createSonarRunner()
    .setProjectDir(new File("projects/schema-check"))
    .setProjectKey(PROJECT_KEY)
    .setProjectName(PROJECT_KEY)
    .setProjectVersion("1.0")
    .setSourceDirs("."));

  IssueQuery query = IssueQuery.create().componentRoots(PROJECT_KEY);
  List<Issue> issues = orchestrator.getServer().wsClient().issueClient().find(query).list();
  assertThat(issues).hasSize(1);
  Issue issue = issues.get(0);
  assertThat(issue.componentKey()).isEqualTo(PROJECT_KEY + ":invalid-html.xml");
  assertThat(issue.line()).isEqualTo(7);
}
 
开发者ID:SonarSource,项目名称:sonar-xml,代码行数:22,代码来源:SchemaCheckTest.java

示例4: testCommentedOutCodeDetection

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
/**
 * SONARPLUGINS-1897
 */
@Test
public void testCommentedOutCodeDetection() {
  String projectKey = "test";
  orchestrator.getServer().provisionProject(projectKey, projectKey);
  orchestrator.getServer().associateProjectToQualityProfile(projectKey, "web", "IT");
  SonarScanner build = WebTestSuite.createSonarScanner()
    .setProjectDir(new File("projects/continuum-webapp/"))
    .setProjectKey(projectKey)
    .setProjectName(projectKey)
    .setProjectVersion("1.0")
    .setSourceDirs("src")
    .setProperty("sonar.sourceEncoding", "UTF-8")
    .setProperty("sonar.web.fileExtensions", ".xhtml,.jspf,.jsp");
  orchestrator.executeBuild(build);

  IssueClient issueClient = orchestrator.getServer().wsClient().issueClient();

  List<Issue> issues = issueClient.find(
    IssueQuery.create()
      .components(keyFor(projectKey, "WEB-INF/jsp/components/projectGroupNotifierSummaryComponent.jsp"))
      .rules("Web:AvoidCommentedOutCodeCheck"))
    .list();
  assertThat(issues.size()).isEqualTo(2);
}
 
开发者ID:SonarSource,项目名称:sonar-web,代码行数:28,代码来源:VariousTest.java

示例5: issues_against_css_rule_forbidden_properties

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void issues_against_css_rule_forbidden_properties() {
  List<Issue> issues = issueClient.find(IssueQuery.create().rules("custom-css:forbidden-properties")).list();

  assertThat(issues).hasSize(1);

  Issue issue = issues.get(0);
  assertThat(issue.line()).isEqualTo(2);
  assertThat(issue.message()).isEqualTo("Remove the usage of this forbidden \"background-color\" property.");
  assertThat(issue.debt()).isEqualTo("5min");
  assertThat(issue.severity()).isEqualTo("MAJOR");
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:13,代码来源:CustomRulesTest.java

示例6: issues_against_css_rule_forbidden_url

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void issues_against_css_rule_forbidden_url() {
  List<Issue> issues = issueClient.find(IssueQuery.create().rules("custom-css:forbidden-url")).list();

  assertThat(issues).hasSize(1);

  Issue issue = issues.get(0);
  assertThat(issue.line()).isEqualTo(3);
  assertThat(issue.message()).isEqualTo("Remove this usage of the forbidden \"paper.gif\" URL.");
  assertThat(issue.debt()).isEqualTo("5min");
  assertThat(issue.severity()).isEqualTo("CRITICAL");
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:13,代码来源:CustomRulesTest.java

示例7: issues_against_less_rule_interpolated_properties

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void issues_against_less_rule_interpolated_properties() {
  List<Issue> issues = issueClient.find(IssueQuery.create().rules("custom-less:interpolated-properties")).list();

  assertThat(issues).hasSize(2);

  Issue issue = issues.get(0);
  assertThat(issue.message()).isEqualTo("Remove this usage of the \"@{my-var}-color\" interpolated property.");
  assertThat(issue.debt()).isEqualTo("5min");
  assertThat(issue.severity()).isEqualTo("CRITICAL");
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:12,代码来源:CustomRulesTest.java

示例8: issues_against_scss_rule_interpolated_properties

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void issues_against_scss_rule_interpolated_properties() {
  List<Issue> issues = issueClient.find(IssueQuery.create().rules("custom-scss:interpolated-properties")).list();

  assertThat(issues).hasSize(2);

  Issue issue = issues.get(0);
  assertThat(issue.message()).isEqualTo("Remove this usage of the \"#{$my-var}-color\" interpolated property.");
  assertThat(issue.debt()).isEqualTo("5min");
  assertThat(issue.severity()).isEqualTo("CRITICAL");
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:12,代码来源:CustomRulesTest.java

示例9: should_analyze_three_files_but_only_raise_issues_and_compute_measures_on_the_non_minified_file

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void should_analyze_three_files_but_only_raise_issues_and_compute_measures_on_the_non_minified_file() {
  List<Issue> issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create()).list();

  assertThat(getProjectMeasure("files")).isEqualTo(3);
  assertThat(getProjectMeasure("ncloc")).isEqualTo(6);
  assertThat(issues).hasSize(1);
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:9,代码来源:MinifiedTest.java

示例10: test

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void test() {
    runSonar();

    final IssueClient issueClient = orchestrator.getServer().wsClient().issueClient();

    final List<Issue> issues = issueClient
            .find(IssueQuery.create().componentRoots("nl.future-edge.sonarqube.plugins:sonar-jdepend-plugin-it"))
            .list();
    Assert.assertEquals(1, issues.size());
    final Issue issue = issues.iterator().next();
    Assert.assertEquals(
            "nl.future-edge.sonarqube.plugins:sonar-jdepend-plugin-it:src/main/java/packagedependencycycle/packagea/package-info.java",
            issue.componentKey());
}
 
开发者ID:willemsrb,项目名称:sonar-jdepend-plugin,代码行数:16,代码来源:PluginIT.java

示例11: issue_for_rule_allowed_tags

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void issue_for_rule_allowed_tags() {
  List<Issue> issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create()).list();

  assertThat(issues).hasSize(2);

  assertThat(issues.get(0).ruleKey()).isEqualTo("gherkin:allowed-tags");
  assertThat(issues.get(0).severity()).isEqualTo("MAJOR");
  assertThat(issues.get(0).line()).isEqualTo(1);

  assertThat(issues.get(1).ruleKey()).isEqualTo("gherkin:allowed-tags");
  assertThat(issues.get(1).severity()).isEqualTo("MAJOR");
  assertThat(issues.get(1).line()).isEqualTo(1);
}
 
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:15,代码来源:IssuesTest.java

示例12: issues_against_rule_forbidden_tag

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void issues_against_rule_forbidden_tag() {
  List<Issue> issues = issueClient.find(IssueQuery.create().rules("custom-gherkin:forbidden-tag")).list();

  assertThat(issues).hasSize(1);

  Issue issue = issues.get(0);
  assertThat(issue.line()).isEqualTo(1);
  assertThat(issue.message()).isEqualTo("Remove this usage of the forbidden \"bar\" tag.");
  assertThat(issue.debt()).isEqualTo("5min");
  assertThat(issue.severity()).isEqualTo("MAJOR");
}
 
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:13,代码来源:CustomRulesTest.java

示例13: issues_against_rule_forbidden_name_content

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void issues_against_rule_forbidden_name_content() {
  List<Issue> issues = issueClient.find(IssueQuery.create().rules("custom-gherkin:forbidden-name-content")).list();

  assertThat(issues).hasSize(1);

  Issue issue = issues.get(0);
  assertThat(issue.line()).isEqualTo(8);
  assertThat(issue.message()).isEqualTo("Remove this usage of \"WTF\".");
  assertThat(issue.debt()).isEqualTo("5min");
  assertThat(issue.severity()).isEqualTo("CRITICAL");
}
 
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:13,代码来源:CustomRulesTest.java

示例14: scan_java_sources_and_bytecode

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void scan_java_sources_and_bytecode() {
  orchestrator.getServer().restoreProfile(ResourceLocation.create("/requires-bytecode-profile.xml"));
  orchestrator.getServer().provisionProject("java:bytecode", "Java Bytecode Sample");
  orchestrator.getServer().associateProjectToQualityProfile("java:bytecode", "java", "requires-bytecode");

  SonarScanner build = newScanner(new File("projects/java-bytecode"));
  orchestrator.executeBuild(build);

  Component project = getComponent("java:bytecode");
  assertThat(project.getName()).isEqualTo("Java Bytecode Sample");

  Map<String, Measure> projectMeasures = getMeasures("java:bytecode", "violations");
  // the squid rules enabled in sonar-way-profile do not exist in SQ 3.0
  assertThat(parseInt(projectMeasures.get("violations").getValue())).isGreaterThan(0);

  assertThat(getMeasureAsInteger("java:bytecode:src/HasFindbugsViolation.java", "violations")).isGreaterThan(0);

  // findbugs is executed on bytecode
  List<Issue> issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create().componentRoots("java:bytecode").rules("squid:S1147")).list();
  assertThat(issues).hasSize(1);
  assertThat(issues.get(0).ruleKey()).isEqualTo("squid:S1147");

  // Squid performs analysis of dependencies
  issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create().componentRoots("java:bytecode").rules("squid:CallToDeprecatedMethod")).list();
  assertThat(issues).hasSize(1);
  assertThat(issues.get(0).ruleKey()).isEqualTo("squid:CallToDeprecatedMethod");
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-cli,代码行数:29,代码来源:JavaTest.java

示例15: issue_for_rule_S1578

import org.sonar.wsclient.issue.IssueQuery; //导入依赖的package包/类
@Test
public void issue_for_rule_S1578() {
  List<Issue> issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create()).list();

  assertThat(issues).hasSize(2);

  assertThat(issues.get(0).ruleKey()).isEqualTo("jproperties:S2068");
  assertThat(issues.get(0).severity()).isEqualTo("CRITICAL");
  assertThat(issues.get(0).line()).isEqualTo(1);

  assertThat(issues.get(1).ruleKey()).isEqualTo("jproperties:S2068");
  assertThat(issues.get(1).severity()).isEqualTo("CRITICAL");
  assertThat(issues.get(1).line()).isEqualTo(1);
}
 
开发者ID:racodond,项目名称:sonar-jproperties-plugin,代码行数:15,代码来源:IssuesTest.java


注:本文中的org.sonar.wsclient.issue.IssueQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。