Skip to content

Commit 6140d22

Browse files
authored
Update beta to stable
2 parents ce55cd2 + 695a084 commit 6140d22

File tree

12 files changed

+237
-25
lines changed

12 files changed

+237
-25
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,4 @@ workflows:
5151
notify:
5252
webhooks:
5353
- url: https://cc-slack-proxy.herokuapp.com/circle
54+

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
FROM openjdk:8-jdk-alpine
1+
FROM openjdk:17-jdk-alpine3.14
22

33
MAINTAINER Code Climate
44

55
RUN adduser -u 9000 -D app
66
VOLUME /code
77

88
# Increase Java memory limits
9-
ENV JAVA_OPTS="-XX:+UseParNewGC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -Xss4096k"
9+
ENV JAVA_OPTS="-XX:+UseG1GC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -Xss4096k"
1010

11-
ENV GRADLE_VERSION=4.2.1
11+
ENV GRADLE_VERSION=7.3
1212
ENV GRADLE_HOME=/opt/gradle
1313
ENV GRADLE_FOLDER=$GRADLE_HOME
1414
ENV GRADLE_USER_HOME=$GRADLE_HOME

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ endif
1010
image:
1111
docker build --rm -t $(IMAGE_NAME) .
1212

13+
analyze-fixtures:
14+
docker run --rm -v "$(PWD)/fixtures/java_lib/main/java":/code -v "$(PWD)/fixtures/java_source_version/config_15.json":/config.json $(IMAGE_NAME)
15+
1316
test: image
1417
docker run --rm -ti -w /usr/src/app -u root $(IMAGE_NAME) gradle clean test
1518

bin/codeclimate-sonar

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ CODE_DIR=$1; shift
1010
CONFIG_FILE=$1; shift
1111

1212
java \
13-
-noverify \
1413
-cp ${APP}:${WRAPPER}:${CORE}:${LIBS} \
1514
-Djava.awt.headless=true \
1615
-Dsonarlint.home="${BUILD_DIR}" \

build.gradle

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ repositories {
77

88
task copyLibs(type: Copy) {
99
into "${buildDir}/libs"
10-
from configurations.runtime
10+
from configurations.runtimeClasspath
1111
exclude "sonar-*-plugin*.jar"
1212
}
1313

1414
task copyTestLibs(type: Copy) {
1515
into "${buildDir}/test"
16-
from configurations.testCompile
16+
from configurations.testRuntimeClasspath
1717
}
1818

1919
task copyPlugins(type: Copy) {
2020
into "${buildDir}/plugins"
21-
from configurations.runtime
21+
from configurations.runtimeClasspath
2222
include "sonar-*-plugin*.jar"
2323
}
2424

@@ -27,20 +27,28 @@ task copyRunnable(type: Copy) {
2727
from "bin/codeclimate-sonar"
2828
}
2929

30+
tasks.named("jar") {
31+
dependsOn copyRunnable
32+
}
33+
34+
tasks.named("compileTestJava") {
35+
dependsOn copyRunnable
36+
}
37+
3038
task infra(dependsOn: ["copyPlugins", "copyLibs", "copyTestLibs", "copyRunnable", "jar"])
3139

3240
build.dependsOn(infra)
3341
test.dependsOn(infra)
3442

3543
dependencies {
36-
compile("com.github.codeclimate:codeclimate-ss-analyzer-wrapper:master-SNAPSHOT")
44+
implementation("com.github.codeclimate:codeclimate-ss-analyzer-wrapper:beta-SNAPSHOT")
3745

3846
// Plugins
39-
compile("org.sonarsource.java:sonar-java-plugin:4.14.0.11784")
47+
implementation("org.sonarsource.java:sonar-java-plugin:6.15.1.26025")
4048

41-
testCompile("org.assertj:assertj-core:2.8.0")
42-
testCompile("org.skyscreamer:jsonassert:1.5.0")
43-
testCompile("junit:junit:4.12")
49+
testImplementation("org.assertj:assertj-core:2.8.0")
50+
testImplementation("org.skyscreamer:jsonassert:1.5.0")
51+
testImplementation("junit:junit:4.12")
4452
}
4553

4654
test {

fixtures/java_lib/main/java/Library.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
* This Java source file was generated by the Gradle 'init' task.
33
*/
44
// FIXME
5+
6+
import java.util.List;
7+
import java.util.Set;
8+
59
public class Library {
10+
List myList; // Noncompliant
11+
Set mySet; // Noncompliant
12+
613
public static void main(String[] args) {
714
}
815

@@ -13,4 +20,20 @@ public void foo() {
1320
}
1421
}
1522
}
23+
24+
public boolean bar(Number n) {
25+
if (String.class.isInstance(n)) { // Noncompliant
26+
return true;
27+
}
28+
String multi = """
29+
this is a single line string""";
30+
String textBlock = """
31+
\"\"\" this \nis
32+
text block!
33+
!!!!
34+
""";
35+
Pattern p = Pattern.compile(".*|a");
36+
Matcher m = p.matcher(multi);
37+
return m.matches();
38+
}
1639
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"enabled": true,
3+
"config": {
4+
"sonar.java.source": "11"
5+
}
6+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"enabled": true,
3+
"config": {
4+
"sonar.java.source": "15",
5+
"minimum_severity": "minor"
6+
}
7+
}

src/test/java/integration/JavaSourceVersion.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,16 @@ public void specify_java_source_version_through_config() throws Exception {
1111
Shell.Process process = Shell.execute("build/codeclimate-sonar fixtures/java_source_version fixtures/java_source_version/config.json");
1212
assertThat(process.stderr).contains("Configured Java source version (sonar.java.source): 6");
1313
}
14+
15+
@Test
16+
public void specify_java_11_source_version_through_config() throws Exception {
17+
Shell.Process process = Shell.execute("build/codeclimate-sonar fixtures/java_source_version fixtures/java_source_version/config_11.json");
18+
assertThat(process.stderr).contains("Configured Java source version (sonar.java.source): 11");
19+
}
20+
21+
@Test
22+
public void specify_java_15_source_version_through_config() throws Exception {
23+
Shell.Process process = Shell.execute("build/codeclimate-sonar fixtures/java_source_version fixtures/java_source_version/config_15.json");
24+
assertThat(process.stderr).contains("Configured Java source version (sonar.java.source): 15");
25+
}
1426
}

src/test/java/integration/SanityCheckTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ public class SanityCheckTest {
1414
public void executeJavaLibFixture() throws Exception {
1515
String expectedOutput = File.read("src/test/resources/sanity_check_expected_issues.json");
1616

17-
Shell.Process process = Shell.execute("build/codeclimate-sonar fixtures/java_lib");
17+
Shell.Process process = Shell.execute("build/codeclimate-sonar fixtures/java_lib fixtures/java_source_version/config_15.json");
1818

19+
assertThat(process.stderr).contains("Configured Java source version (sonar.java.source): 15");
1920
assertThat(process.exitCode).isEqualTo(0);
2021
assertThat(process.stdout)
2122
.withFailMessage("Issues must be split by a NULL (\\0) character")

0 commit comments

Comments
 (0)