@Test public void test_sonarlint() { SonarRuntime runtime = SonarRuntimeImpl.forSonarLint(Version.create(3, 9)); Plugin.Context context = new PluginContextImpl.Builder().setSonarRuntime(runtime).build(); KotlinPlugin kotlinPlugin = new KotlinPlugin(); kotlinPlugin.define(context); assertThat(context.getExtensions()).hasSize(4); }
@Override public void define(Context context) { context.addExtensions( KotlinLanguage.class, KotlinSensor.class, KotlinRulesDefinition.class, KotlinProfileDefinition.class); boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); if (context.getRuntime().getProduct() != SonarProduct.SONARLINT) { context.addExtensions( new DetektRulesDefinition(externalIssuesSupported), DetektSensor.class, new AndroidLintRulesDefinition(externalIssuesSupported), AndroidLintSensor.class, PropertyDefinition.builder(KOTLIN_FILE_SUFFIXES_KEY) .defaultValue(KOTLIN_FILE_SUFFIXES_DEFAULT_VALUE) .name("File Suffixes") .description("List of suffixes for files to analyze.") .subCategory(GENERAL) .category(KOTLIN_CATEGORY) .multiValues(true) .onQualifiers(Qualifiers.PROJECT) .build()); if (externalIssuesSupported) { context.addExtensions( PropertyDefinition.builder(DetektSensor.REPORT_PROPERTY_KEY) .name("Detekt Report Files") .description("Paths (absolute or relative) to checkstyle xml files with detekt issues.") .category(EXTERNAL_ANALYZERS_CATEGORY) .subCategory(KOTLIN_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(AndroidLintSensor.REPORT_PROPERTY_KEY) .name("Android Lint Report Files") .description("Paths (absolute or relative) to xml files with Android Lint issues.") .category(EXTERNAL_ANALYZERS_CATEGORY) .subCategory(ANDROID_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build()); } } }
KotlinPlugin implements Plugin { @Override public void define(Context context) { context.addExtensions( KotlinLanguage.class, KotlinSensor.class, KotlinRulesDefinition.class, KotlinProfileDefinition.class); boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); if (context.getRuntime().getProduct() != SonarProduct.SONARLINT) { context.addExtensions( new DetektRulesDefinition(externalIssuesSupported), DetektSensor.class, new AndroidLintRulesDefinition(externalIssuesSupported), AndroidLintSensor.class, PropertyDefinition.builder(KOTLIN_FILE_SUFFIXES_KEY) .defaultValue(KOTLIN_FILE_SUFFIXES_DEFAULT_VALUE) .name("File Suffixes") .description("List of suffixes for files to analyze.") .subCategory(GENERAL) .category(KOTLIN_CATEGORY) .multiValues(true) .onQualifiers(Qualifiers.PROJECT) .build()); if (externalIssuesSupported) { context.addExtensions( PropertyDefinition.builder(DetektSensor.REPORT_PROPERTY_KEY) .name("Detekt Report Files") .description("Paths (absolute or relative) to checkstyle xml files with detekt issues.") .category(EXTERNAL_ANALYZERS_CATEGORY) .subCategory(KOTLIN_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(AndroidLintSensor.REPORT_PROPERTY_KEY) .name("Android Lint Report Files") .description("Paths (absolute or relative) to xml files with Android Lint issues.") .category(EXTERNAL_ANALYZERS_CATEGORY) .subCategory(ANDROID_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build()); } } } }
KotlinPlugin implements Plugin { @Override public void define(Context context) { context.addExtensions( KotlinLanguage.class, KotlinSensor.class, KotlinRulesDefinition.class, KotlinProfileDefinition.class); boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); if (context.getRuntime().getProduct() != SonarProduct.SONARLINT) { context.addExtensions( new DetektRulesDefinition(externalIssuesSupported), DetektSensor.class, new AndroidLintRulesDefinition(externalIssuesSupported), AndroidLintSensor.class, PropertyDefinition.builder(KOTLIN_FILE_SUFFIXES_KEY) .defaultValue(KOTLIN_FILE_SUFFIXES_DEFAULT_VALUE) .name("File Suffixes") .description("List of suffixes for files to analyze.") .subCategory(GENERAL) .category(KOTLIN_CATEGORY) .multiValues(true) .onQualifiers(Qualifiers.PROJECT) .build()); if (externalIssuesSupported) { context.addExtensions( PropertyDefinition.builder(DetektSensor.REPORT_PROPERTY_KEY) .name("Detekt Report Files") .description("Paths (absolute or relative) to checkstyle xml files with detekt issues.") .category(EXTERNAL_ANALYZERS_CATEGORY) .subCategory(KOTLIN_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(AndroidLintSensor.REPORT_PROPERTY_KEY) .name("Android Lint Report Files") .description("Paths (absolute or relative) to xml files with Android Lint issues.") .category(EXTERNAL_ANALYZERS_CATEGORY) .subCategory(ANDROID_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build()); } } }  }
KotlinPlugin implements Plugin { @Override public void define(Context context) { context.addExtensions( KotlinLanguage.class, KotlinSensor.class, KotlinRulesDefinition.class, KotlinProfileDefinition.class); boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); if (context.getRuntime().getProduct() != SonarProduct.SONARLINT) { context.addExtensions( new DetektRulesDefinition(externalIssuesSupported), DetektSensor.class, new AndroidLintRulesDefinition(externalIssuesSupported), AndroidLintSensor.class, PropertyDefinition.builder(KOTLIN_FILE_SUFFIXES_KEY) .defaultValue(KOTLIN_FILE_SUFFIXES_DEFAULT_VALUE) .name("File Suffixes") .description("List of suffixes for files to analyze.") .subCategory(GENERAL) .category(KOTLIN_CATEGORY) .multiValues(true) .onQualifiers(Qualifiers.PROJECT) .build()); if (externalIssuesSupported) { context.addExtensions( PropertyDefinition.builder(DetektSensor.REPORT_PROPERTY_KEY) .name("Detekt Report Files") .description("Paths (absolute or relative) to checkstyle xml files with detekt issues.") .category(EXTERNAL_ANALYZERS_CATEGORY) .subCategory(KOTLIN_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(AndroidLintSensor.REPORT_PROPERTY_KEY) .name("Android Lint Report Files") .description("Paths (absolute or relative) to xml files with Android Lint issues.") .category(EXTERNAL_ANALYZERS_CATEGORY) .subCategory(ANDROID_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build()); } } }  @Override void define(Context context); }
KotlinPlugin implements Plugin { @Override public void define(Context context) { context.addExtensions( KotlinLanguage.class, KotlinSensor.class, KotlinRulesDefinition.class, KotlinProfileDefinition.class); boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); if (context.getRuntime().getProduct() != SonarProduct.SONARLINT) { context.addExtensions( new DetektRulesDefinition(externalIssuesSupported), DetektSensor.class, new AndroidLintRulesDefinition(externalIssuesSupported), AndroidLintSensor.class, PropertyDefinition.builder(KOTLIN_FILE_SUFFIXES_KEY) .defaultValue(KOTLIN_FILE_SUFFIXES_DEFAULT_VALUE) .name("File Suffixes") .description("List of suffixes for files to analyze.") .subCategory(GENERAL) .category(KOTLIN_CATEGORY) .multiValues(true) .onQualifiers(Qualifiers.PROJECT) .build()); if (externalIssuesSupported) { context.addExtensions( PropertyDefinition.builder(DetektSensor.REPORT_PROPERTY_KEY) .name("Detekt Report Files") .description("Paths (absolute or relative) to checkstyle xml files with detekt issues.") .category(EXTERNAL_ANALYZERS_CATEGORY) .subCategory(KOTLIN_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build(), PropertyDefinition.builder(AndroidLintSensor.REPORT_PROPERTY_KEY) .name("Android Lint Report Files") .description("Paths (absolute or relative) to xml files with Android Lint issues.") .category(EXTERNAL_ANALYZERS_CATEGORY) .subCategory(ANDROID_SUBCATEGORY) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .build()); } } }  @Override void define(Context context); static final String KOTLIN_LANGUAGE_KEY; static final String KOTLIN_LANGUAGE_NAME; static final String KOTLIN_REPOSITORY_KEY; static final String REPOSITORY_NAME; static final String PROFILE_NAME; static final String KOTLIN_FILE_SUFFIXES_KEY; static final String KOTLIN_FILE_SUFFIXES_DEFAULT_VALUE; }