Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,23 @@

public class JavaPlugin implements Plugin {

@SuppressWarnings("unchecked")
@Override
public void define(Context context) {
List<Object> list = new ArrayList<>();

addProductSpecificExtensions(context, list);
if (supportJspTranspilation(context)) {
list.add(Jasper.class);
}
list.addAll(ClasspathProperties.getProperties());
list.addAll(coreExtensions());

list.add(AnalysisWarningsWrapper.class);
list.add(DefaultModuleMetadata.class);
context.addExtensions(Collections.unmodifiableList(list));
}

private static void addProductSpecificExtensions(Context context, List<Object> list) {
if (context.getRuntime().getProduct() == SonarProduct.SONARLINT) {
list.add(NoOpTelemetry.class);
// Some custom rules (i.e. DBD) depend on the presence of SonarLintCache when executing in a SonarLint context.
Expand All @@ -66,11 +78,16 @@ public void define(Context context) {

ExternalReportExtensions.define(context);
}
if (supportJspTranspilation(context)) {
list.add(Jasper.class);
}
list.addAll(ClasspathProperties.getProperties());
list.addAll(Arrays.asList(
}

private static boolean supportJspTranspilation(Context context) {
// currently, only security rules are interested in jsp
return context.getRuntime().getProduct() == SonarProduct.SONARQUBE
&& context.getRuntime().getEdition() != SonarEdition.COMMUNITY;
}

private static List<Object> coreExtensions() {
return Arrays.asList(
ClasspathForMain.class,
ClasspathForTest.class,
Java.class,
Expand Down Expand Up @@ -147,16 +164,6 @@ public void define(Context context) {
.defaultValue("True")
.build(),
JavaSensor.class,
PostAnalysisIssueFilter.class));

list.add(AnalysisWarningsWrapper.class);
list.add(DefaultModuleMetadata.class);
context.addExtensions(Collections.unmodifiableList(list));
}

private static boolean supportJspTranspilation(Context context) {
// currently, only security rules are interested in jsp
return context.getRuntime().getProduct() == SonarProduct.SONARQUBE
&& context.getRuntime().getEdition() != SonarEdition.COMMUNITY;
PostAnalysisIssueFilter.class);
}
}
Loading