Skip to content

Commit 6001064

Browse files
author
Vincent Potucek
committed
Fix NPE add EqualsAvoidsNull #TODO
Signed-off-by: Vincent Potucek <vpotucek@me.com>
1 parent 61e427c commit 6001064

22 files changed

+107
-51
lines changed

.github/workflows/build-pull-request.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
name: Build Pull Request
1+
name: Build Pull Request 🏭️
22
on: pull_request
33
permissions:
44
contents: read
55
jobs:
66
build:
7-
name: Build Pull Request
7+
name: Build 🏗
88
if: ${{ github.repository == 'spring-projects/spring-boot' }}
99
runs-on: ${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }}
1010
steps:
11-
- name: Check Out Code
11+
- name: Checkout Code 📥
1212
uses: actions/checkout@v6
13-
- name: Build
13+
- name: Build 📦
1414
id: build
1515
uses: ./.github/actions/build
16-
- name: Print JVM Thread Dumps When Cancelled
16+
- name: Log Potentially Cancelled JVM Thread Dumps 📋
1717
if: cancelled()
1818
uses: ./.github/actions/print-jvm-thread-dumps
19-
- name: Upload Build Reports
19+
- name: Upload Build Report 📊
2020
if: failure()
2121
uses: actions/upload-artifact@v5
2222
with:

.github/workflows/run-codeql-analysis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: "Run CodeQL Analysis"
1+
name: Run CodeQL Analysis 📊
22
on:
33
push:
44
pull_request:
55
workflow_dispatch:
66
permissions: read-all
77
jobs:
88
run-analysis:
9+
name: Inspect 🔎
910
permissions:
1011
actions: read
1112
contents: read

.github/workflows/sanity.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Sanity Check 🕊️
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
permissions: read-all
7+
jobs:
8+
verify:
9+
name: Verify 📊
10+
if: ${{ github.repository == 'spring-projects/spring-boot' }}
11+
runs-on: ${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }}
12+
steps:
13+
- name: Checkout Code 📥
14+
uses: actions/checkout@v6
15+
- name: Build 📦
16+
id: build
17+
uses: ./.github/actions/build
18+
- name: Rewrite ♻️
19+
run: ./gradlew rewriteDryRun

buildSrc/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ plugins {
2020
id "checkstyle"
2121
id "eclipse"
2222
id "org.jetbrains.dokka" version "2.1.0"
23+
id "org.openrewrite.rewrite" version "7.22.0" apply false
2324
}
2425

2526
repositories {
@@ -185,3 +186,6 @@ eclipse {
185186
}
186187

187188
jar.dependsOn check
189+
190+
apply from: rootProject.file("${rootDir}/config/rewrite.gradle")
191+
//apply from: rootProject.file("${rootDir}/gradle/rewrite.gradle")

buildSrc/config/rewrite.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
project.apply(plugin: "org.openrewrite.rewrite")
2+
3+
dependencies {
4+
rewrite("org.openrewrite.recipe:rewrite-static-analysis:2.23.0")
5+
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:3.23.0")
6+
}
7+
8+
rewrite {
9+
activeRecipe("org.springframework.boot.openrewrite.SanityCheck")
10+
configFile = project.getRootProject().file("${rootDir}/config/rewrite.yml")
11+
exclusion( // incompatible
12+
"**AggregatorPlugin.java",
13+
"**AntoraConventions.java",
14+
"**ArchitectureCheckTests.java",
15+
"**architecture/junit/enumsource**",
16+
)
17+
setExportDatatables(true)
18+
setFailOnDryRunResults(true)
19+
}

buildSrc/config/rewrite.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
type: specs.openrewrite.org/v1beta/recipe
3+
name: org.springframework.boot.openrewrite.SanityCheck
4+
displayName: Apply all common best practices
5+
description: Comprehensive code quality recipe combining modernization, security, and best practices.
6+
recipeList:
7+
- org.openrewrite.gradle.UpdateGradleWrapper
8+
- org.openrewrite.java.testing.junit.JupiterBestPractices
9+
- org.openrewrite.java.testing.junit5.CleanupAssertions
10+
- org.openrewrite.staticanalysis.EqualsAvoidsNull
11+
- tech.picnic.errorprone.refasterrules.TimeRulesRecipes
12+
- tech.picnic.errorprone.refasterrules.EqualityRulesRecipes
13+
# - tech.picnic.errorprone.refasterrules.NullRulesRecipes
14+
# - tech.picnic.errorprone.refasterrules.StreamRulesRecipes
15+
# - tech.picnic.errorprone.refasterrules.StringRulesRecipes
16+
---

buildSrc/src/main/java/org/springframework/boot/build/DeployedPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ public void apply(Project project) {
4747
project.afterEvaluate((evaluated) -> project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> {
4848
if (((Jar) project.getTasks().getByName(JavaPlugin.JAR_TASK_NAME)).isEnabled()) {
4949
project.getComponents()
50-
.matching((component) -> component.getName().equals("java"))
50+
.matching((component) -> "java".equals(component.getName()))
5151
.all(mavenPublication::from);
5252
}
5353
}));
5454
project.getPlugins()
5555
.withType(JavaPlatformPlugin.class)
5656
.all((javaPlugin) -> project.getComponents()
57-
.matching((component) -> component.getName().equals("javaPlatform"))
57+
.matching((component) -> "javaPlatform".equals(component.getName()))
5858
.all(mavenPublication::from));
5959
}
6060

buildSrc/src/main/java/org/springframework/boot/build/MavenRepositoryPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ public void apply(Project project) {
6262
mavenRepository.setUrl(repositoryLocation.toURI());
6363
});
6464
project.getTasks()
65-
.matching((task) -> task.getName().equals(PUBLISH_TO_PROJECT_REPOSITORY_TASK_NAME))
65+
.matching((task) -> PUBLISH_TO_PROJECT_REPOSITORY_TASK_NAME.equals(task.getName()))
6666
.all((task) -> setUpProjectRepository(project, task, repositoryLocation));
6767
project.getTasks()
68-
.matching((task) -> task.getName().equals("publishPluginMavenPublicationToProjectRepository"))
68+
.matching((task) -> "publishPluginMavenPublicationToProjectRepository".equals(task.getName()))
6969
.all((task) -> setUpProjectRepository(project, task, repositoryLocation));
7070
}
7171

buildSrc/src/main/java/org/springframework/boot/build/antora/CheckJavadocMacros.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ private WellKnownAnchor(Origin origin) {
336336
}
337337

338338
private static WellKnownAnchor of(String anchor, Origin origin) {
339-
if (anchor.equals("enum-constant-summary")) {
339+
if ("enum-constant-summary".equals(anchor)) {
340340
return new WellKnownAnchor(origin);
341341
}
342342
return null;

buildSrc/src/main/java/org/springframework/boot/build/architecture/AutoConfigurationChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private JavaClass[] getImportedClasses(JavaClass javaClass) {
117117

118118
private boolean isBootClass(JavaClass javaClass) {
119119
String pkg = javaClass.getPackage().getName();
120-
return pkg.equals(SPRING_BOOT_ROOT_PACKAGE) || pkg.startsWith(SPRING_BOOT_ROOT_PACKAGE + ".");
120+
return SPRING_BOOT_ROOT_PACKAGE.equals(pkg) || pkg.startsWith(SPRING_BOOT_ROOT_PACKAGE + ".");
121121
}
122122

123123
}

0 commit comments

Comments
 (0)