com.sonar.orchestrator.build.SonarScanner Java Examples
The following examples show how to use
com.sonar.orchestrator.build.SonarScanner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomRulesTest.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 6 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/custom-rules/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setCssProfile("css-custom-rules-profile", PROJECT_KEY); Tests.setLessProfile("less-custom-rules-profile", PROJECT_KEY); Tests.setScssProfile("scss-custom-rules-profile", PROJECT_KEY); orchestrator.executeBuild(build); issueClient = orchestrator.getServer().wsClient().issueClient(); }
Example #2
Source File: CloverTest.java From sonar-clover with Apache License 2.0 | 6 votes |
@Test public void reuse_report_project_groovy() { String project = "groovy-clover-sample"; String groovyFile = keyFor(project, "org/sonar/Example.groovy", ":src/main/groovy/"); orchestrator.getServer().provisionProject("groovy-clover-sample", "groovy-clover-sample"); orchestrator.getServer().associateProjectToQualityProfile("groovy-clover-sample", "grvy", "rules"); SonarScanner analysis = SonarScanner.create() .setProjectName(project) .setProjectKey(project) .setProjectVersion("1.0") .setSourceDirs("src/main/groovy") .setLanguage("grvy") .setProjectDir(new File("projects/groovy-clover-sample")) .setProperty("sonar.clover.reportPath", "clover.xml"); orchestrator.executeBuild(analysis); assertThat(getMeasure(project, "lines_to_cover")).isEqualTo(2); assertThat(getMeasure(project, "uncovered_lines")).isEqualTo(0); assertThat(getMeasure(groovyFile, "files")).isEqualTo(1); assertThat(getMeasure(groovyFile, "lines_to_cover")).isEqualTo(2); assertThat(getMeasure(groovyFile, "uncovered_lines")).isEqualTo(0); }
Example #3
Source File: CloverTest.java From sonar-clover with Apache License 2.0 | 6 votes |
@Test public void reuse_report_project_java() { String project = "reuseReport"; String file = keyFor(project, "HelloWorld.java", ":src/main/java/"); SonarScanner analysis = SonarScanner.create() .setProjectName(project) .setProjectKey(project) .setProjectVersion("1.0") .setSourceDirs("src/main/java") .setProjectDir(new File("projects/reuseReport")) .setProperty("sonar.clover.reportPath", "clover.xml") .setProperty("sonar.java.binaries", "target/classes"); if (!orchestrator.getConfiguration().getPluginVersion("clover").isGreaterThan("2.9")) { analysis.setProperty("sonar.java.coveragePlugin", "clover"); } orchestrator.executeBuild(analysis); assertThat(getMeasure(project, "lines_to_cover")).isEqualTo(8); assertThat(getMeasure(project, "uncovered_lines")).isEqualTo(4); assertThat(getMeasure(file, "files")).isEqualTo(1); assertThat(getMeasure(file, "lines_to_cover")).isEqualTo(4); assertThat(getMeasure(file, "uncovered_lines")).isEqualTo(2); }
Example #4
Source File: GherkinRulingTest.java From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 | 6 votes |
@Test public void test() throws Exception { File litsDifferencesFile = FileLocation.of("target/differences").getFile(); orchestrator.getServer().provisionProject("project", "project"); orchestrator.getServer().associateProjectToQualityProfile("project", "gherkin", "rules"); SonarScanner build = SonarScanner.create(FileLocation.of("../projects").getFile()) .setProjectKey("project") .setLanguage("gherkin") .setSourceDirs("./") .setSourceEncoding("UTF-8") .setProperty("sonar.analysis.mode", "preview") .setProperty("sonar.issuesReport.html.enable", "true") .setProperty("dump.old", FileLocation.of("src/test/expected").getFile().getAbsolutePath()) .setProperty("dump.new", FileLocation.of("target/actual").getFile().getAbsolutePath()) .setProperty("lits.differences", litsDifferencesFile.getAbsolutePath()) .setProperty("sonar.cpd.skip", "true") .setProperty("sonar.exclusions", "custom/spelling/spelling-fr.feature," + "custom/indentation/indentation-custom-ok.feature," + "custom/indentation/indentation-custom-ko.feature" ); orchestrator.executeBuild(build); assertThat(Files.asCharSource(litsDifferencesFile, StandardCharsets.UTF_8).read()).isEmpty(); }
Example #5
Source File: CssTest.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 6 votes |
@Test public void test() throws Exception { File litsDifferencesFile = FileLocation.of("target/differences").getFile(); orchestrator.getServer().provisionProject("project", "project"); orchestrator.getServer().associateProjectToQualityProfile("project", "css", "rules"); orchestrator.getServer().associateProjectToQualityProfile("project", "less", "rules"); orchestrator.getServer().associateProjectToQualityProfile("project", "scss", "rules"); SonarScanner build = SonarScanner.create(FileLocation.of("../projects").getFile()) .setProjectKey("project") .setSourceDirs("./") .setSourceEncoding("UTF-8") .setProperty("sonar.import_unknown_files", "true") .setProperty("sonar.analysis.mode", "preview") .setProperty("sonar.issuesReport.html.enable", "true") .setProperty("dump.old", FileLocation.of("src/test/expected").getFile().getAbsolutePath()) .setProperty("dump.new", FileLocation.of("target/actual").getFile().getAbsolutePath()) .setProperty("lits.differences", litsDifferencesFile.getAbsolutePath()) .setProperty("sonar.cpd.skip", "true"); orchestrator.executeBuild(build); assertThat(Files.asCharSource(litsDifferencesFile, StandardCharsets.UTF_8).read()).isEmpty(); }
Example #6
Source File: Tests.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 5 votes |
public static SonarScanner createSonarScannerBuild() { SonarScanner build = SonarScanner.create(); build.setProjectVersion("1.0"); build.setSourceEncoding("UTF-8"); build.setSourceDirs("src"); return build; }
Example #7
Source File: ScssMetricsTest.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/scss-metrics/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setScssProfile("scss-empty-profile", PROJECT_KEY); orchestrator.executeBuild(build); }
Example #8
Source File: CssDuplicationsTest.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/css-duplications/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setCssProfile("css-empty-profile", PROJECT_KEY); orchestrator.executeBuild(build); }
Example #9
Source File: CssMetricsTest.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/css-metrics/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setCssProfile("css-empty-profile", PROJECT_KEY); orchestrator.executeBuild(build); }
Example #10
Source File: MinifiedTest.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/minified/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setCssProfile("css-zero-units-only-profile", PROJECT_KEY); orchestrator.executeBuild(build); }
Example #11
Source File: LessDuplicationsTest.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/less-duplications/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setLessProfile("less-empty-profile", PROJECT_KEY); orchestrator.executeBuild(build); }
Example #12
Source File: IssuesTest.java From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@org.junit.BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/issues/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setProfile("allowed-tags-only-profile", PROJECT_KEY); orchestrator.executeBuild(build); }
Example #13
Source File: CustomRulesTest.java From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/custom-rules/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setProfile("gherkin-custom-rules-profile", PROJECT_KEY); orchestrator.executeBuild(build); issueClient = orchestrator.getServer().wsClient().issueClient(); }
Example #14
Source File: MetricsTest.java From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/metrics/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setProfile("empty-profile", PROJECT_KEY); orchestrator.executeBuild(build); }
Example #15
Source File: Tests.java From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 | 5 votes |
public static SonarScanner createSonarScannerBuild() { SonarScanner build = SonarScanner.create(); build.setProjectVersion("1.0"); build.setSourceEncoding("UTF-8"); build.setSourceDirs("src"); return build; }
Example #16
Source File: ScssDuplicationsTest.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/scss-duplications/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setScssProfile("scss-empty-profile", PROJECT_KEY); orchestrator.executeBuild(build); }
Example #17
Source File: LessMetricsTest.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/less-metrics/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setLessProfile("less-empty-profile", PROJECT_KEY); orchestrator.executeBuild(build); }
Example #18
Source File: IssuesTest.java From sonar-css-plugin with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { orchestrator.resetData(); SonarScanner build = Tests.createSonarScannerBuild() .setProjectDir(new File("../projects/issues/")) .setProjectKey(PROJECT_KEY) .setProjectName(PROJECT_KEY); orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); Tests.setCssProfile("css-zero-units-only-profile", PROJECT_KEY); Tests.setLessProfile("less-zero-units-only-profile", PROJECT_KEY); Tests.setScssProfile("scss-zero-units-only-profile", PROJECT_KEY); orchestrator.executeBuild(build); }