Skip to content
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
30 changes: 16 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,18 @@ jobs:
strategy:
fail-fast: false
matrix:
runner:
- github-ubuntu-latest-m
- github-windows-latest-m
profile:
- without-sonarqube-project
- only-sonarqube-project
item:
- { runner: github-ubuntu-latest-m, profile: without-sonarqube-project }
- { runner: github-ubuntu-latest-m, profile: only-sonarqube-project }
- { runner: github-ubuntu-latest-m, profile: only-guava-project, java_version: 17, sonar-runtime: "LATEST_RELEASE[2025.4]" }
- { runner: github-windows-latest-m, profile: without-sonarqube-project }
- { runner: github-windows-latest-m, profile: only-sonarqube-project }
- { runner: github-windows-latest-m, profile: only-guava-project, java_version: 17, sonar-runtime: "LATEST_RELEASE[2025.4]" }
name: Ruling QA
needs:
- build
if: ${{ needs.build.outputs.deployed }}
runs-on: ${{ matrix.runner }}
runs-on: ${{ matrix.item.runner }}
permissions:
id-token: write
contents: write
Expand All @@ -77,8 +78,10 @@ jobs:
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
with:
version: 2025.7.12
- name: Select Java 17
run: mise use java@17
- name: Select Java Version
env:
JAVA_VERSION: ${{ matrix.item.java_version || '21' }}
run: mise use "java@${{ env.JAVA_VERSION }}"
- name: Configure Maven
uses: SonarSource/ci-github-actions/config-maven@v1
with:
Expand All @@ -96,9 +99,10 @@ jobs:
env:
MAVEN_OPTS: "-Xmx3g"
GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }}
SONAR_RUNTIME: ${{ matrix.item.sonar-runtime || 'LATEST_RELEASE' }}
run: |
cd its/ruling
mvn package --batch-mode "-Pit-ruling,${{ matrix.profile }}" -Dsonar.runtimeVersion=LATEST_RELEASE -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dparallel=methods -DuseUnlimitedThreads=true
mvn package --batch-mode "-Pit-ruling,${{ matrix.item.profile }}" "-Dsonar.runtimeVersion=${{ env.SONAR_RUNTIME }}" -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dparallel=methods -DuseUnlimitedThreads=true

plugin-qa:
strategy:
Expand All @@ -107,8 +111,6 @@ jobs:
item:
- sq_version: LATEST_RELEASE
java_version: 21
- sq_version: LATEST_RELEASE
java_version: 17
- sq_version: DEV
java_version: 21
name: Plugin QA
Expand Down Expand Up @@ -306,8 +308,8 @@ jobs:
working-directory: java-checks-test-sources
run: |
mvn clean compile test-compile --batch-mode
- name: Select Java 17
run: mise use java@17
- name: Select Java 21
run: mise use java@21
- uses: SonarSource/ci-github-actions/config-maven@v1
with:
artifactory-reader-role: private-reader
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ To run tests locally follow these instructions.

### Java versions

You need `Java 25` to compile and run the Unit Tests of the project and `Java 17` run the Integration Tests (ITs).
Note that `Java 21` can be used to build and test all modules except under `java-checks-test-sources` (as they require `Java 25`) and `its` (as they require `Java 17` because of SQ incompatibility).
You need `Java 25` to compile and run the Unit Tests of the project and `Java 21` run most Integration Tests (ITs).
Ruling test on Guava project require `Java 17`.
Note that `Java 21` can be used to build and test all modules except under `java-checks-test-sources` (as they require `Java 25`).

### Build the Project and Run Unit Tests

Expand Down Expand Up @@ -121,7 +122,7 @@ From the `its/ruling` folder, launch the ruling tests:

mvn clean install -Pit-ruling -DcommunityEditionTestsOnly=true
# Alternatively
JAVA_HOME=/my/local/java17/jdk/ mvn clean install -Pit-ruling -DcommunityEditionTestsOnly=true
JAVA_HOME=/my/local/java21/jdk/ mvn clean install -Pit-ruling -DcommunityEditionTestsOnly=true

Note for internal contributors: in order to also execute the tests that depend on the SonarQube Server Enterprise Edition, use:

Expand Down Expand Up @@ -172,7 +173,7 @@ mvn clean compile
To run the tests, move to the [`its/autoscan`](its/autoscan) folder and run:
```shell
# cd its/autoscan
# use Java 17!
# use Java 21!
mvn clean package --batch-mode --errors --show-version \
--activate-profiles it-autoscan \
-Dsonar.runtimeVersion=LATEST_RELEASE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void javaCheckTestSources() throws Exception {
softly.assertThat(newDiffs).containsExactlyInAnyOrderElementsOf(knownDiffs.values());
softly.assertThat(newTotal).isEqualTo(knownTotal);
softly.assertThat(rulesCausingFPs).hasSize(10);
softly.assertThat(rulesNotReporting).hasSize(17);
softly.assertThat(rulesNotReporting).hasSize(14);

/**
* 4. Check total number of differences (FPs + FNs)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ruleKey": "S5738",
"hasTruePositives": true,
"falseNegatives": 4,
"falseNegatives": 3,
"falsePositives": 0
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ruleKey": "S6901",
"hasTruePositives": false,
"hasTruePositives": true,
"falseNegatives": 0,
"falsePositives": 0
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ruleKey": "S6913",
"hasTruePositives": false,
"hasTruePositives": true,
"falseNegatives": 0,
"falsePositives": 0
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ruleKey": "S6915",
"hasTruePositives": false,
"hasTruePositives": true,
"falseNegatives": 0,
"falsePositives": 0
}
16 changes: 15 additions & 1 deletion its/ruling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<test>!org.sonar.java.it.JavaRulingTest#sonarqube_server</test>
<test>!org.sonar.java.it.JavaRulingTest#sonarqube_server,!org.sonar.java.it.JavaRulingTest#guava</test>
</configuration>
</plugin>
</plugins>
Expand All @@ -128,6 +128,20 @@
</plugins>
</build>
</profile>
<profile>
<id>only-guava-project</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<test>org.sonar.java.it.JavaRulingTest#guava</test>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
7 changes: 7 additions & 0 deletions its/ruling/src/test/resources/eclipse-jetty/java-S5738.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"org.eclipse.jetty:jetty-project:jetty-util/src/main/java/org/eclipse/jetty/util/TypeUtil.java": [
680
],
"org.eclipse.jetty:jetty-project:jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java": [
198,
216
],
"org.eclipse.jetty:jetty-project:jetty-util/src/test/java/org/eclipse/jetty/util/thread/QueuedThreadPoolTest.java": [
730
],
"org.eclipse.jetty:jetty-project:jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java": [
1761
]
Expand Down
Loading