Skip to content
Closed
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
15 changes: 15 additions & 0 deletions .cirrus/.cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,18 @@ sq_analysis_task:
- .cirrus/cirrus-sq-analysis.sh
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
<<: *DEFAULT_ARTIFACTS_TEMPLATE

rewrite_task:
depends_on: junit_task
container:
dockerfile: .cirrus/Dockerfile
cpu: 8
memory: 10Gb
no_output_timeout: 1.5h
# timeout: 1.5h
<<: *DEFAULT_TEMPLATE
<<: *GRADLE_CACHE_TEMPLATE
script:
- .cirrus/cirrus-rewrite.sh
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
<<: *DEFAULT_ARTIFACTS_TEMPLATE
7 changes: 7 additions & 0 deletions .cirrus/cirrus-rewrite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail

source .cirrus/cirrus-env

./gradlew rewriteDryRun --build-cache -Dorg.gradle.jvmargs=-Xmx8G
# https://docs.openrewrite.org/reference/faq#im-getting-javalangoutofmemoryerror-java-heap-space-when-running-openrewrite
17 changes: 10 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@ import org.sonar.build.BlackBoxTest

import static org.gradle.api.JavaVersion.VERSION_17

// Ordered alphabetically
plugins {
// Ordered alphabetically
//id 'com.jfrog.artifactory' version '5.2.5' // dont update new version contains a bug
id 'com.github.hierynomus.license' version '0.16.1'
id "com.github.hierynomus.license-report" version "0.16.1" apply false
id 'com.gradleup.shadow' version '8.3.6' apply false
id 'com.github.hierynomus.license-report' version '0.16.1' apply false
id 'com.google.protobuf' version '0.8.19' apply false
// dont update com.jfrog.artifactory, new version contains a bug
id 'com.jfrog.artifactory' version '5.2.5'
id "de.undercouch.download" version "5.6.0" apply false
id 'com.gradleup.shadow' version '8.3.6' apply false
id 'com.jfrog.artifactory' version '6.0.0'
id 'de.undercouch.download' version '5.6.0' apply false
id 'io.spring.dependency-management' version '1.1.7'
id "org.cyclonedx.bom" version "2.3.1" apply false
id 'org.cyclonedx.bom' version '2.3.1' apply false
id 'org.openrewrite.rewrite' version '7.12.1' apply false
id 'org.sonarqube' version '6.2.0.5505'
}

apply from: "$rootDir/gradle/rewrite.gradle"

if (!JavaVersion.current().isCompatibleWith(VERSION_17)) {
throw new GradleException("JDK 17+ is required to perform this build. It's currently " + System.getProperty("java.home") + ".")
}
Expand Down
30 changes: 17 additions & 13 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
group=org.sonarsource.sonarqube
version=25.8
# End Of Life date for the version. MMF-3763. format is yyyy-MM-dd
# 6 months from the release date for non LTA versions
# 18 months from the release date for LTA versions
# 6 months from the release date for non LTA versions
# End Of Life date for the version. MMF-3763. format is yyyy-MM-dd
# No change required for patch versions
versionEOL=2026-04-01
pdfreportVersion=2.0.0.263
pluginApiVersion=13.0.0.3026
artifactoryUrl=https://repox.jfrog.io/repox
description=Open source platform for continuous inspection of code quality
projectTitle=SonarQube
org.gradle.jvmargs=-Xmx2048m
elasticSearchServerVersion=8.16.3
group=org.sonarsource.sonarqube
jre_release_name=jdk-17.0.13+11
options.forkOptions.memoryMaximumSize=2g
org.gradle.caching=true
org.gradle.jvmargs=-Xmx4g
org.gradle.parallel=true
org.gradle.vfs.watch=true
elasticSearchServerVersion=8.16.3
org.gradle.warning.mode=none
org.gradle.workers.max=2
pdfreportVersion=2.0.0.263
pluginApiVersion=13.0.0.3026
projectTitle=SonarQube
projectType=application
artifactoryUrl=https://repox.jfrog.io/repox
jre_release_name=jdk-17.0.13+11
webappVersion=2025.4.0.23179
version=25.8
versionEOL=2026-04-01
webappVersion=2025.4.0.23179
54 changes: 54 additions & 0 deletions gradle/rewrite.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
project.apply plugin: "org.openrewrite.rewrite"

rewrite {
activeRecipe(
"org.openrewrite.gradle.GradleBestPractices",
"org.openrewrite.java.RemoveUnusedImports",
"org.openrewrite.staticanalysis.LowercasePackage",
"org.openrewrite.staticanalysis.ModifierOrder",
"org.openrewrite.staticanalysis.RemoveUnusedLocalVariables",
"org.openrewrite.staticanalysis.RemoveUnusedPrivateFields",
"org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods",
"tech.picnic.errorprone.refasterrules.BugCheckerRulesRecipes",
"tech.picnic.errorprone.refasterrules.SuggestedFixRulesRecipes",
//"org.openrewrite.java.migrate.UpgradeToJava17",
//"org.openrewrite.java.recipes.JavaRecipeBestPractices",
//"org.openrewrite.java.recipes.RecipeNullabilityBestPractices",
//"org.openrewrite.java.recipes.RecipeTestingBestPractices",
//"org.openrewrite.staticanalysis.CodeCleanup",
//"org.openrewrite.staticanalysis.CommonStaticAnalysis",
//"org.openrewrite.staticanalysis.EqualsAvoidsNull",
//"org.openrewrite.staticanalysis.JavaApiBestPractices",
//"org.openrewrite.staticanalysis.MissingOverrideAnnotation",
//"org.openrewrite.staticanalysis.NoFinalizer",
//"org.openrewrite.staticanalysis.UnnecessaryThrows",
//"org.sonar.openrewrite.java.AddLicenseHeader", https://github.com/openrewrite/rewrite/issues/5762
//"tech.picnic.errorprone.refasterrules.BigDecimalRulesRecipes",
//"tech.picnic.errorprone.refasterrules.CharSequenceRulesRecipes",
//"tech.picnic.errorprone.refasterrules.ClassRulesRecipes",
//"tech.picnic.errorprone.refasterrules.CollectionRulesRecipes", bug
//"tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes",
//"tech.picnic.errorprone.refasterrules.EqualityRulesRecipes",
//"tech.picnic.errorprone.refasterrules.FileRulesRecipes",
//"tech.picnic.errorprone.refasterrules.JUnitRulesRecipes",
//"tech.picnic.errorprone.refasterrules.MicrometerRulesRecipes",
//"tech.picnic.errorprone.refasterrules.NullRulesRecipes",
//"tech.picnic.errorprone.refasterrules.OptionalRulesRecipes",
//"tech.picnic.errorprone.refasterrules.PatternRulesRecipes",
//"tech.picnic.errorprone.refasterrules.PreconditionsRulesRecipes",
//"tech.picnic.errorprone.refasterrules.PrimitiveRulesRecipes",
//"tech.picnic.errorprone.refasterrules.StreamRulesRecipes",
//"tech.picnic.errorprone.refasterrules.StringRulesRecipes",
//"tech.picnic.errorprone.refasterrules.TimeRulesRecipes",
)
exclusions.add("**DefaultAdminCredentialsVerifierImpl.java") // bug
exportDatatables = true
failOnDryRunResults = true
}

dependencies {
rewrite("org.openrewrite.recipe:rewrite-migrate-java:3.14.1")
rewrite("org.openrewrite.recipe:rewrite-rewrite:0.10.1")
rewrite("org.openrewrite.recipe:rewrite-static-analysis:2.14.0")
rewrite("org.openrewrite.recipe:rewrite-third-party:0.24.1")
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
3 changes: 1 addition & 2 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ public class EducationRulesDefinition implements RulesDefinition {

public static final String EDUCATION_RULE_REPOSITORY_KEY = "edu";
public static final String EDUCATION_KEY = "education";

private static final String[] ALL_SECTIONS = {INTRODUCTION_SECTION_KEY, ROOT_CAUSE_SECTION_KEY, ASSESS_THE_PROBLEM_SECTION_KEY,
RESOURCES_SECTION_KEY, HOW_TO_FIX_SECTION_KEY};
private static final String IGNORED_FAKE_SECTION = "fake_section_to_be_ignored";

public static final String[] CONTEXTS = {"spring", "hibernate", "apache_commons", "vaadin", "mybatis"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
@RunWith(DataProviderRunner.class)
public class GithubApplicationClientImplTest {
private static final String ORG_NAME = "ORG_NAME";
private static final String TEAM_NAME = "team1";
private static final String REPO_NAME = "repo1";
private static final String APP_URL = "https://github.com/";
private static final String REPO_TEAMS_ENDPOINT = "/repos/ORG_NAME/repo1/teams";
Expand Down
1 change: 1 addition & 0 deletions server/sonar-auth-github/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
testImplementation project(path: ':server:sonar-webserver-api')

testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.13.4"
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,12 @@
package org.sonar.auth.github;

import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.model.OAuthRequest;
import com.github.scribejava.core.model.Response;
import com.github.scribejava.core.model.Verb;
import com.github.scribejava.core.oauth.OAuth20Service;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.util.List;
import java.util.concurrent.ExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static java.lang.String.format;
import static org.sonar.auth.OAuthRestClient.executePaginatedRequest;
import static org.sonar.auth.OAuthRestClient.executeRequest;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@

import org.junit.Test;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.server.authentication.UserIdentity;
import org.sonar.api.utils.System2;

import static org.assertj.core.api.Assertions.assertThat;

public class UserIdentityFactoryImplTest {


private MapSettings settings = new MapSettings(new PropertyDefinitions(System2.INSTANCE, GitHubSettings.definitions()));
private UserIdentityFactoryImpl underTest = new UserIdentityFactoryImpl();

@Test
Expand Down
1 change: 1 addition & 0 deletions server/sonar-auth-gitlab/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies {
testImplementation 'org.mockito:mockito-junit-jupiter'

testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.13.4"
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}

Expand Down
1 change: 1 addition & 0 deletions server/sonar-auth-ldap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies {
testImplementation project(":sonar-testing-ldap")

testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.13.4"
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}

Expand Down
1 change: 1 addition & 0 deletions server/sonar-auth-saml/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies {
testImplementation testFixtures(project(':server:sonar-db-dao'))

testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.13.4"
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@
*/
package org.sonar.auth.saml;

import java.util.regex.Pattern;
import org.sonar.api.server.ServerSide;
import org.sonar.api.server.authentication.Display;
import org.sonar.api.server.authentication.OAuth2IdentityProvider;
import org.sonar.api.server.authentication.UserIdentity;

@ServerSide
public class SamlIdentityProvider implements OAuth2IdentityProvider {

private static final Pattern HTTPS_PATTERN = Pattern.compile("https?://");
public static final String KEY = "saml";

public static final String RSA_SHA_256_URL = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,6 @@ private CeTaskSubmit createTaskSubmit(String type, @Nullable Component component
.build();
}

private ComponentDto insertComponent(ComponentDto componentDto) {
return db.components().insertComponent(componentDto);
}

private UserDto insertUser(UserDto userDto) {
db.getDbClient().userDao().insert(session, userDto);
session.commit();
Expand Down
3 changes: 2 additions & 1 deletion server/sonar-ce-task-projectanalysis/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ dependencies {
testFixturesCompileOnly 'com.github.spotbugs:spotbugs-annotations'

testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.13.4"
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@

@RunWith(DataProviderRunner.class)
public class BranchPersisterImplIT {
private final static Component MAIN = builder(Component.Type.PROJECT, 1, "PROJECT_KEY").setUuid("PROJECT_UUID").setName("p1").build();
private final static Component BRANCH1 = builder(Component.Type.PROJECT, 2, "BRANCH_KEY").setUuid("BRANCH_UUID").build();
private final static Component PR1 = builder(Component.Type.PROJECT, 3, "develop").setUuid("PR_UUID").build();
private static final Component MAIN = builder(Component.Type.PROJECT, 1, "PROJECT_KEY").setUuid("PROJECT_UUID").setName("p1").build();
private static final Component BRANCH1 = builder(Component.Type.PROJECT, 2, "BRANCH_KEY").setUuid("BRANCH_UUID").build();
private static final Component PR1 = builder(Component.Type.PROJECT, 3, "develop").setUuid("PR_UUID").build();
private static final Project PROJECT = new Project("PROJECT_UUID", MAIN.getKey(), MAIN.getName(), null, Collections.emptyList());

@Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import static org.sonar.ce.task.projectanalysis.component.ReportComponent.builder;

public class ProjectPersisterIT {
private final static Component ROOT = builder(PROJECT, 1)
private static final Component ROOT = builder(PROJECT, 1)
.setUuid("PROJECT_UUID")
.setKey("PROJECT_KEY")
.setDescription("PROJECT_DESC")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import static org.mockito.Mockito.when;

class TrackerReferenceBranchInputFactoryIT {
private final static String COMPONENT_KEY = "file1";
private final static String COMPONENT_UUID = "uuid1";
private static final String COMPONENT_KEY = "file1";
private static final String COMPONENT_UUID = "uuid1";

@RegisterExtension
private final DbTester db = DbTester.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import static org.mockito.Mockito.when;

public class TrackerSourceBranchInputFactoryIT {
private final static String COMPONENT_KEY = "file1";
private final static String COMPONENT_UUID = "uuid1";
private static final String COMPONENT_KEY = "file1";
private static final String COMPONENT_UUID = "uuid1";

@Rule
public DbTester db = DbTester.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
import static org.mockito.Mockito.when;

public class TrackerTargetBranchInputFactoryIT {
private final static String COMPONENT_KEY = "file1";
private final static String COMPONENT_UUID = "uuid1";
private final static String ORIGINAL_COMPONENT_KEY = "file2";
private final static String ORIGINAL_COMPONENT_UUID = "uuid2";
private static final String COMPONENT_KEY = "file1";
private static final String COMPONENT_UUID = "uuid1";
private static final String ORIGINAL_COMPONENT_KEY = "file2";
private static final String ORIGINAL_COMPONENT_UUID = "uuid2";

@Rule
public DbTester db = DbTester.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,9 @@ public class MeasureRepositoryImplIT {
private static final ReportComponent FILE_COMPONENT = ReportComponent.builder(Component.Type.FILE, 1).setKey(FILE_COMPONENT_KEY).build();
private static final ReportComponent OTHER_COMPONENT = ReportComponent.builder(Component.Type.FILE, 2).setKey("some other key").build();
private static final String METRIC_KEY_1 = "metric 1";
private static final int METRIC_ID_1 = 1;
private static final String METRIC_KEY_2 = "metric 2";
private static final int METRIC_ID_2 = 2;
private final Metric metric1 = mock(Metric.class);
private final Metric metric2 = mock(Metric.class);
private static final String LAST_ANALYSIS_UUID = "u123";
private static final String OTHER_ANALYSIS_UUID = "u369";
private static final Measure SOME_MEASURE = Measure.newMeasureBuilder().create("some value");
private static final String SOME_DATA = "some data";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import com.tngtech.java.junit.dataprovider.UseDataProvider;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Random;
import java.util.stream.Stream;
Expand Down Expand Up @@ -489,16 +487,6 @@ public static Object[][] anyValidLeakPeriodSettingValue() {
};
}

private List<SnapshotDto> createSnapshots(ComponentDto project) {
ArrayList<SnapshotDto> list = new ArrayList<>();
list.add(dbTester.components().insertSnapshot(project, snapshot -> snapshot.setCreatedAt(1226379600000L).setLast(false))); // 2008-11-11
list.add(dbTester.components().insertSnapshot(project, snapshot -> snapshot.setCreatedAt(1226494680000L).setLast(false))); // 2008-11-12
list.add(dbTester.components().insertSnapshot(project, snapshot -> snapshot.setCreatedAt(1227157200000L).setLast(false))); // 2008-11-20
list.add(dbTester.components().insertSnapshot(project, snapshot -> snapshot.setCreatedAt(1227358680000L).setLast(false))); // 2008-11-22
list.add(dbTester.components().insertSnapshot(project, snapshot -> snapshot.setCreatedAt(1227934800000L).setLast(true))); // 2008-11-29
return list;
}

private long milisSinceEpoch(int year, int month, int day, int hour) {
return ZonedDateTime.of(year, month, day, hour, 0, 0, 0, ZoneId.systemDefault())
.toInstant().toEpochMilli();
Expand Down
Loading