-
Notifications
You must be signed in to change notification settings - Fork 1
Format code with Spotless #53
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
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds Spotless formatting via Maven and an .editorconfig; replaces pre-commit hooks with a Maven formatting check in CI. Applies widespread code formatting changes across Java sources and tests and introduces behavioral changes in ApitallyClient sendHubRequest and RequestLogger public accessor/JSON handling. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
============================================
+ Coverage 77.95% 78.68% +0.72%
+ Complexity 357 354 -3
============================================
Files 34 34
Lines 1184 1276 +92
Branches 150 162 +12
============================================
+ Hits 923 1004 +81
- Misses 178 187 +9
- Partials 83 85 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/io/apitally/spring/ApitallyProperties.java (1)
60-77: Good defensive changes, but consider handling non-assignable class case.The explicit
setCallbacks(null)in the catch block (line 72) and else branch (lines 74-76) are good defensive additions. However, there's a silent failure path: if the class loads successfully but does not implementRequestLoggingCallbacks, the code silently does nothing—no warning is logged, andcallbacksretains its previous value.Consider adding a warning and explicit null assignment for this case:
Suggested improvement
public void setCallbacksClass(String callbacksClass) { this.callbacksClass = callbacksClass; if (callbacksClass != null) { try { Class<?> clazz = Class.forName(callbacksClass); if (RequestLoggingCallbacks.class.isAssignableFrom(clazz)) { setCallbacks( (RequestLoggingCallbacks) clazz.getDeclaredConstructor().newInstance()); + } else { + logger.warn( + "Class {} does not implement RequestLoggingCallbacks", + callbacksClass); + setCallbacks(null); } } catch (ReflectiveOperationException e) { logger.error("Failed to initialize request logging callbacks", e); setCallbacks(null); } } else { setCallbacks(null); } }
🤖 Fix all issues with AI agents
In `@pom.xml`:
- Around line 115-129: The Spotless config uses google-java-format version
1.33.0 (inside the <googleJavaFormat> block) which requires JDK 21 at runtime
while the plugin (<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId> version 3.1.0) targets Java 17;
fix by either updating your build/runtime JDK to 21 so the formatter can run, or
change the <googleJavaFormat><version> value to a pre-1.29.x release compatible
with Java 17 (e.g., 1.28.x) and keep the rest of the Spotless configuration
intact; update whichever option you choose consistently in the pom where
<googleJavaFormat> version is declared.
🧹 Nitpick comments (2)
src/main/java/io/apitally/spring/ApitallyProperties.java (1)
54-54: Annotation placement may reduce readability.Having the
@Patternannotation on the same line as the field declaration is unusual. Typically, annotations are placed on their own line for better readability. However, if this is the output from Spotless with the configured settings, it's acceptable to keep for consistency.src/main/java/io/apitally/common/ApitallyClient.java (1)
225-271: Avoid blocking the common pool insendHubRequest.
CompletableFuture.supplyAsyncwithout an executor runs on the ForkJoinPool common pool, but the body uses blockingHttpClient.send. Consider a dedicated executor (and shutting it down inshutdown) or switching tosendAsyncto prevent pool starvation under load.♻️ Example adjustment
- return CompletableFuture.supplyAsync( - () -> { + return CompletableFuture.supplyAsync( + () -> { // ... - }); + }, hubRequestExecutor);
| <plugin> | ||
| <groupId>com.diffplug.spotless</groupId> | ||
| <artifactId>spotless-maven-plugin</artifactId> | ||
| <version>3.1.0</version> | ||
| <configuration> | ||
| <java> | ||
| <googleJavaFormat> | ||
| <version>1.33.0</version> | ||
| <style>AOSP</style> | ||
| </googleJavaFormat> | ||
| <removeUnusedImports /> | ||
| <formatAnnotations /> | ||
| </java> | ||
| </configuration> | ||
| </plugin> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
com.diffplug.spotless spotless-maven-plugin latest version 2024 2025
💡 Result:
-
Latest released in 2024: spotless-maven-plugin 2.43.0 (released Jan 23, 2024). [1]
-
Latest released in 2025: spotless-maven-plugin 2.46.0 (released Jul 20, 2025). [2]
Sources: Maven Central listings for com.diffplug.spotless:spotless-maven-plugin. [1] [2]
References:
[1] https://repo.maven.apache.org/maven2/com/diffplug/spotless/spotless-maven-plugin/
[2] https://repo.maven.apache.org/maven2/com/diffplug/spotless/spotless-maven-plugin/2.46.0/
🌐 Web query:
google-java-format 1.33.0 Java 17 compatibility requirements
💡 Result:
Short answer: google-java-format 1.33.0 can format Java 17 source, but the formatter itself requires a newer JDK to run — the project raised the minimum JDK to run google-java-format to JDK 21 (change introduced in v1.29.0). See the README note that the minimum runtime is declared in core/pom.xml and the v1.29.0 release note. [1][2]
Sources:
- google-java-format README (notes about minimum Java in core/pom.xml / usage). [1]
- google-java-format releases (v1.29.0: "The minimum support JDK version to run google-java-format is now JDK 21"). [2]
🌐 Web query:
spotless-maven-plugin 3.1.0 release date Java compatibility
💡 Result:
-
Release date: spotless-maven-plugin 3.1.0 was published to Maven Central on 2025-11-18. [1]
-
Java compatibility: Spotless bumped its required Java to Java 17 in the 3.0.0 series, so 3.1.0 requires Java 17 (or newer). [2]
Sources:
[1] Maven Central (com.diffplug.spotless:spotless-maven-plugin — 3.1.0 listing).
[2] diffplug/spotless GitHub releases — note for Maven/3.0.0: "Bump the required Java to 17."
Incompatible JDK requirement: google-java-format 1.33.0 requires JDK 21 to run.
The plugin version 3.1.0 requires Java 17, but google-java-format 1.33.0 (used within it) requires JDK 21 runtime as of v1.29.0. This means your build environment must have JDK 21 available for the formatter to execute, even if compiling with Java 17. Either upgrade to a higher Java version for the build or use an older google-java-format version compatible with Java 17.
🤖 Prompt for AI Agents
In `@pom.xml` around lines 115 - 129, The Spotless config uses google-java-format
version 1.33.0 (inside the <googleJavaFormat> block) which requires JDK 21 at
runtime while the plugin (<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId> version 3.1.0) targets Java 17;
fix by either updating your build/runtime JDK to 21 so the formatter can run, or
change the <googleJavaFormat><version> value to a pre-1.29.x release compatible
with Java 17 (e.g., 1.28.x) and keep the rest of the Spotless configuration
intact; update whichever option you choose consistently in the pom where
<googleJavaFormat> version is declared.
Summary by CodeRabbit
New Features
Chores
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.