@Test public void count_extension_points_7_2() { SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(7, 2), SonarQubeSide.SCANNER); Plugin.Context context = new Plugin.Context(runtime); Plugin underTest = new GoPlugin(); underTest.define(context); assertThat(context.getExtensions()).hasSize(19); }
@Override public void define(Context context) { boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); context.addExtensions( GoLanguage.class, GoSensor.class, GoTestSensor.class, GoCoverSensor.class, GoExclusionsFileFilter.class, new GoRulesDefinition(externalIssuesSupported), GoProfileDefinition.class, GoVetReportSensor.class, GoLintReportSensor.class, GoMetaLinterReportSensor.class, GolangCILintReportSensor.class, PropertyDefinition.builder(GoLanguage.FILE_SUFFIXES_KEY) .index(10) .name("File Suffixes") .description("List of suffixes for files to analyze.") .category(GO_CATEGORY) .subCategory(GENERAL_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue(GoLanguage.FILE_SUFFIXES_DEFAULT_VALUE) .multiValues(true) .build(), PropertyDefinition.builder(EXCLUSIONS_KEY) .index(11) .defaultValue(EXCLUSIONS_DEFAULT_VALUE) .name("Go Exclusions") .description("List of file path patterns to be excluded from analysis of Go files.") .category(GO_CATEGORY) .subCategory(GENERAL_SUBCATEGORY) .onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(GoTestSensor.REPORT_PATH_KEY) .index(19) .name("Path to test execution report(s)") .description("Path to test execution reports generated by Go with '-json' key, available since go1.10 (e.g.: go test -json > test-report.out).") .category(GO_CATEGORY) .subCategory(TEST_COVERAGE_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(GoCoverSensor.REPORT_PATH_KEY) .index(20) .name("Path to coverage report(s)") .description("Path to coverage reports generated by Go (e.g.: go test -coverprofile=coverage.out), ant patterns relative to project root are supported.") .category(GO_CATEGORY) .subCategory(TEST_COVERAGE_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build()); if (externalIssuesSupported) { context.addExtensions( PropertyDefinition.builder(GoVetReportSensor.PROPERTY_KEY) .index(30) .name("\"go vet\" Report Files") .description("Paths (absolute or relative) to the files with \"go vet\" issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GoLintReportSensor.PROPERTY_KEY) .index(31) .name("Golint Report Files") .description("Paths (absolute or relative) to the files with Golint issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GoMetaLinterReportSensor.PROPERTY_KEY) .index(32) .name("GoMetaLinter Report Files") .description("Paths (absolute or relative) to the files with GoMetaLinter issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GolangCILintReportSensor.PROPERTY_KEY) .index(33) .name("GolangCI-Lint Report Files") .description("Paths (absolute or relative) to the files with GolangCI-Lint issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build()); } }
GoPlugin implements Plugin { @Override public void define(Context context) { boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); context.addExtensions( GoLanguage.class, GoSensor.class, GoTestSensor.class, GoCoverSensor.class, GoExclusionsFileFilter.class, new GoRulesDefinition(externalIssuesSupported), GoProfileDefinition.class, GoVetReportSensor.class, GoLintReportSensor.class, GoMetaLinterReportSensor.class, GolangCILintReportSensor.class, PropertyDefinition.builder(GoLanguage.FILE_SUFFIXES_KEY) .index(10) .name("File Suffixes") .description("List of suffixes for files to analyze.") .category(GO_CATEGORY) .subCategory(GENERAL_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue(GoLanguage.FILE_SUFFIXES_DEFAULT_VALUE) .multiValues(true) .build(), PropertyDefinition.builder(EXCLUSIONS_KEY) .index(11) .defaultValue(EXCLUSIONS_DEFAULT_VALUE) .name("Go Exclusions") .description("List of file path patterns to be excluded from analysis of Go files.") .category(GO_CATEGORY) .subCategory(GENERAL_SUBCATEGORY) .onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(GoTestSensor.REPORT_PATH_KEY) .index(19) .name("Path to test execution report(s)") .description("Path to test execution reports generated by Go with '-json' key, available since go1.10 (e.g.: go test -json > test-report.out).") .category(GO_CATEGORY) .subCategory(TEST_COVERAGE_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(GoCoverSensor.REPORT_PATH_KEY) .index(20) .name("Path to coverage report(s)") .description("Path to coverage reports generated by Go (e.g.: go test -coverprofile=coverage.out), ant patterns relative to project root are supported.") .category(GO_CATEGORY) .subCategory(TEST_COVERAGE_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build()); if (externalIssuesSupported) { context.addExtensions( PropertyDefinition.builder(GoVetReportSensor.PROPERTY_KEY) .index(30) .name("\"go vet\" Report Files") .description("Paths (absolute or relative) to the files with \"go vet\" issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GoLintReportSensor.PROPERTY_KEY) .index(31) .name("Golint Report Files") .description("Paths (absolute or relative) to the files with Golint issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GoMetaLinterReportSensor.PROPERTY_KEY) .index(32) .name("GoMetaLinter Report Files") .description("Paths (absolute or relative) to the files with GoMetaLinter issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GolangCILintReportSensor.PROPERTY_KEY) .index(33) .name("GolangCI-Lint Report Files") .description("Paths (absolute or relative) to the files with GolangCI-Lint issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build()); } } }
GoPlugin implements Plugin { @Override public void define(Context context) { boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); context.addExtensions( GoLanguage.class, GoSensor.class, GoTestSensor.class, GoCoverSensor.class, GoExclusionsFileFilter.class, new GoRulesDefinition(externalIssuesSupported), GoProfileDefinition.class, GoVetReportSensor.class, GoLintReportSensor.class, GoMetaLinterReportSensor.class, GolangCILintReportSensor.class, PropertyDefinition.builder(GoLanguage.FILE_SUFFIXES_KEY) .index(10) .name("File Suffixes") .description("List of suffixes for files to analyze.") .category(GO_CATEGORY) .subCategory(GENERAL_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue(GoLanguage.FILE_SUFFIXES_DEFAULT_VALUE) .multiValues(true) .build(), PropertyDefinition.builder(EXCLUSIONS_KEY) .index(11) .defaultValue(EXCLUSIONS_DEFAULT_VALUE) .name("Go Exclusions") .description("List of file path patterns to be excluded from analysis of Go files.") .category(GO_CATEGORY) .subCategory(GENERAL_SUBCATEGORY) .onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(GoTestSensor.REPORT_PATH_KEY) .index(19) .name("Path to test execution report(s)") .description("Path to test execution reports generated by Go with '-json' key, available since go1.10 (e.g.: go test -json > test-report.out).") .category(GO_CATEGORY) .subCategory(TEST_COVERAGE_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(GoCoverSensor.REPORT_PATH_KEY) .index(20) .name("Path to coverage report(s)") .description("Path to coverage reports generated by Go (e.g.: go test -coverprofile=coverage.out), ant patterns relative to project root are supported.") .category(GO_CATEGORY) .subCategory(TEST_COVERAGE_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build()); if (externalIssuesSupported) { context.addExtensions( PropertyDefinition.builder(GoVetReportSensor.PROPERTY_KEY) .index(30) .name("\"go vet\" Report Files") .description("Paths (absolute or relative) to the files with \"go vet\" issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GoLintReportSensor.PROPERTY_KEY) .index(31) .name("Golint Report Files") .description("Paths (absolute or relative) to the files with Golint issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GoMetaLinterReportSensor.PROPERTY_KEY) .index(32) .name("GoMetaLinter Report Files") .description("Paths (absolute or relative) to the files with GoMetaLinter issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GolangCILintReportSensor.PROPERTY_KEY) .index(33) .name("GolangCI-Lint Report Files") .description("Paths (absolute or relative) to the files with GolangCI-Lint issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build()); } }  }
GoPlugin implements Plugin { @Override public void define(Context context) { boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); context.addExtensions( GoLanguage.class, GoSensor.class, GoTestSensor.class, GoCoverSensor.class, GoExclusionsFileFilter.class, new GoRulesDefinition(externalIssuesSupported), GoProfileDefinition.class, GoVetReportSensor.class, GoLintReportSensor.class, GoMetaLinterReportSensor.class, GolangCILintReportSensor.class, PropertyDefinition.builder(GoLanguage.FILE_SUFFIXES_KEY) .index(10) .name("File Suffixes") .description("List of suffixes for files to analyze.") .category(GO_CATEGORY) .subCategory(GENERAL_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue(GoLanguage.FILE_SUFFIXES_DEFAULT_VALUE) .multiValues(true) .build(), PropertyDefinition.builder(EXCLUSIONS_KEY) .index(11) .defaultValue(EXCLUSIONS_DEFAULT_VALUE) .name("Go Exclusions") .description("List of file path patterns to be excluded from analysis of Go files.") .category(GO_CATEGORY) .subCategory(GENERAL_SUBCATEGORY) .onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(GoTestSensor.REPORT_PATH_KEY) .index(19) .name("Path to test execution report(s)") .description("Path to test execution reports generated by Go with '-json' key, available since go1.10 (e.g.: go test -json > test-report.out).") .category(GO_CATEGORY) .subCategory(TEST_COVERAGE_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(GoCoverSensor.REPORT_PATH_KEY) .index(20) .name("Path to coverage report(s)") .description("Path to coverage reports generated by Go (e.g.: go test -coverprofile=coverage.out), ant patterns relative to project root are supported.") .category(GO_CATEGORY) .subCategory(TEST_COVERAGE_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build()); if (externalIssuesSupported) { context.addExtensions( PropertyDefinition.builder(GoVetReportSensor.PROPERTY_KEY) .index(30) .name("\"go vet\" Report Files") .description("Paths (absolute or relative) to the files with \"go vet\" issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GoLintReportSensor.PROPERTY_KEY) .index(31) .name("Golint Report Files") .description("Paths (absolute or relative) to the files with Golint issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GoMetaLinterReportSensor.PROPERTY_KEY) .index(32) .name("GoMetaLinter Report Files") .description("Paths (absolute or relative) to the files with GoMetaLinter issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GolangCILintReportSensor.PROPERTY_KEY) .index(33) .name("GolangCI-Lint Report Files") .description("Paths (absolute or relative) to the files with GolangCI-Lint issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build()); } }  @Override void define(Context context); }
GoPlugin implements Plugin { @Override public void define(Context context) { boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); context.addExtensions( GoLanguage.class, GoSensor.class, GoTestSensor.class, GoCoverSensor.class, GoExclusionsFileFilter.class, new GoRulesDefinition(externalIssuesSupported), GoProfileDefinition.class, GoVetReportSensor.class, GoLintReportSensor.class, GoMetaLinterReportSensor.class, GolangCILintReportSensor.class, PropertyDefinition.builder(GoLanguage.FILE_SUFFIXES_KEY) .index(10) .name("File Suffixes") .description("List of suffixes for files to analyze.") .category(GO_CATEGORY) .subCategory(GENERAL_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue(GoLanguage.FILE_SUFFIXES_DEFAULT_VALUE) .multiValues(true) .build(), PropertyDefinition.builder(EXCLUSIONS_KEY) .index(11) .defaultValue(EXCLUSIONS_DEFAULT_VALUE) .name("Go Exclusions") .description("List of file path patterns to be excluded from analysis of Go files.") .category(GO_CATEGORY) .subCategory(GENERAL_SUBCATEGORY) .onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(GoTestSensor.REPORT_PATH_KEY) .index(19) .name("Path to test execution report(s)") .description("Path to test execution reports generated by Go with '-json' key, available since go1.10 (e.g.: go test -json > test-report.out).") .category(GO_CATEGORY) .subCategory(TEST_COVERAGE_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(GoCoverSensor.REPORT_PATH_KEY) .index(20) .name("Path to coverage report(s)") .description("Path to coverage reports generated by Go (e.g.: go test -coverprofile=coverage.out), ant patterns relative to project root are supported.") .category(GO_CATEGORY) .subCategory(TEST_COVERAGE_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build()); if (externalIssuesSupported) { context.addExtensions( PropertyDefinition.builder(GoVetReportSensor.PROPERTY_KEY) .index(30) .name("\"go vet\" Report Files") .description("Paths (absolute or relative) to the files with \"go vet\" issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GoLintReportSensor.PROPERTY_KEY) .index(31) .name("Golint Report Files") .description("Paths (absolute or relative) to the files with Golint issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GoMetaLinterReportSensor.PROPERTY_KEY) .index(32) .name("GoMetaLinter Report Files") .description("Paths (absolute or relative) to the files with GoMetaLinter issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build(), PropertyDefinition.builder(GolangCILintReportSensor.PROPERTY_KEY) .index(33) .name("GolangCI-Lint Report Files") .description("Paths (absolute or relative) to the files with GolangCI-Lint issues.") .category(GO_CATEGORY) .subCategory(EXTERNAL_LINTER_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .defaultValue("") .multiValues(true) .build()); } }  @Override void define(Context context); static final String EXCLUSIONS_KEY; static final String EXCLUSIONS_DEFAULT_VALUE; }