Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #40: removed sonar-java-plugin #439

Merged
merged 1 commit into from
Oct 21, 2022
Merged
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
14 changes: 3 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,11 @@
</properties>

<dependencies>
<!-- till https://github.com/checkstyle/sonar-checkstyle/issues/40 -->
<dependency>
<groupId>org.sonarsource.java</groupId>
<artifactId>sonar-java-plugin</artifactId>
<version>${sonar-java.version}</version>
<groupId>com.fasterxml.staxmate</groupId>
<artifactId>staxmate</artifactId>
Copy link
Member Author

@rnveach rnveach Oct 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New dependency was required since the other included it and we still use it as well.

<version>2.4.0</version>
<scope>provided</scope>
<!-- to avoid 4.5.1 api pickup -->
<exclusions>
<exclusion>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- required to load external descriptiona, see CheckstyleRulesDefinition -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.sonar.api.batch.sensor.Sensor;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.SensorDescriptor;
import org.sonar.plugins.java.Java;

public class CheckstyleSensor implements Sensor {

Expand All @@ -34,7 +33,7 @@ public CheckstyleSensor(CheckstyleExecutor executor) {

@Override
public void describe(SensorDescriptor descriptor) {
descriptor.onlyOnLanguage(Java.KEY).name("CheckstyleSensor");
descriptor.onlyOnLanguage("java").name("CheckstyleSensor");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comes from sonar-java-plugin and so we have to hardcode it since we want to remove that dependency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public class Java extends AbstractLanguage {

  /**
   * Java key
   */
  public static final String KEY = "java";

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.junit.Test;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
import org.sonar.plugins.java.Java;

public class CheckstyleSensorTest {

Expand All @@ -37,7 +36,7 @@ public void shouldDescribePluginCorrectly() {
final CheckstyleSensor sensor = new CheckstyleSensor(null);

sensor.describe(descriptor);
assertThat(descriptor.languages()).containsOnly(Java.KEY);
assertThat(descriptor.languages()).containsOnly("java");
assertThat(descriptor.name()).isNotEmpty();
}

Expand Down