Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.
Draft
Show file tree
Hide file tree
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
30 changes: 1 addition & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.sonarsource.parent</groupId>
<artifactId>parent</artifactId>
<version>54</version>
<version>55</version>
</parent>

<groupId>org.sonarsource.java</groupId>
Expand Down Expand Up @@ -124,34 +124,6 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.sonarsource.sslr-squid-bridge</groupId>
<artifactId>sslr-squid-bridge</artifactId>
<version>2.6.1</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.sonar.sslr</groupId>
<artifactId>sslr-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</exclusion>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.sonarsource.java</groupId>
<artifactId>java-checks-testkit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand All @@ -24,12 +24,12 @@
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Locale;
import javax.annotation.Nullable;
import org.sonar.api.rule.RuleStatus;
import org.sonar.api.server.rule.RulesDefinition;
import org.sonar.plugins.java.Java;
import org.sonar.squidbridge.annotations.AnnotationBasedRulesDefinition;
import org.sonar.api.server.rule.RulesDefinitionAnnotationLoader;

public class JavaDebuggingRulesDefinition implements RulesDefinition {

Expand All @@ -41,10 +41,12 @@ public class JavaDebuggingRulesDefinition implements RulesDefinition {
@Override
public void define(Context context) {
NewRepository repository = context
.createRepository(REPOSITORY_KEY, Java.KEY).setName(REPOSITORY_NAME);
.createRepository(REPOSITORY_KEY, "java")
.setName(REPOSITORY_NAME);

new AnnotationBasedRulesDefinition(repository, Java.KEY)
.addRuleClasses(/* don't fail if no SQALE annotations */ false, RulesList.getChecks());
List<Class<?>> checks = RulesList.getChecks();
new RulesDefinitionAnnotationLoader()
.load(repository, checks.toArray(new Class[]{}));

for (NewRule rule : repository.rules()) {
String metadataKey = rule.key();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand Down
21 changes: 10 additions & 11 deletions src/main/java/org/sonar/debugging/java/RulesList.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand All @@ -19,8 +19,9 @@
*/
package org.sonar.debugging.java;

import com.google.common.collect.ImmutableList;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import org.sonar.debugging.java.checks.UnknownConstructorCheck;
import org.sonar.debugging.java.checks.UnknownMethodCheck;
import org.sonar.plugins.java.api.JavaCheck;
Expand All @@ -32,19 +33,17 @@ public final class RulesList {
private RulesList() {
}

public static List<Class> getChecks() {
return ImmutableList.<Class>builder().addAll(getJavaChecks()).addAll(getJavaTestChecks()).build();
public static List<Class<?>> getChecks() {
ArrayList<Class<?>> classes = new ArrayList<>(getJavaChecks());
classes.addAll(getJavaTestChecks());
return classes;
}

public static List<Class<? extends JavaCheck>> getJavaChecks() {
return ImmutableList.<Class<? extends JavaCheck>>builder()
.add(UnknownMethodCheck.class)
.add(UnknownConstructorCheck.class)
.build();
return Arrays.asList(UnknownMethodCheck.class, UnknownConstructorCheck.class);
}

public static List<Class<? extends JavaCheck>> getJavaTestChecks() {
return ImmutableList.<Class<? extends JavaCheck>>builder()
.build();
return Collections.emptyList();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sonar/debugging/java/package-info.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java Debugging Rules
* Copyright (C) 2015-2020 SonarSource SA
* Copyright (C) 2015-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand Down