This is an automated email from the ASF dual-hosted git repository.
He-Pin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-persistence-r2dbc.git
The following commit(s) were added to refs/heads/main by this push:
new 0cf454e chore: unify formatter config - standardize aliases, add
JDK17 setting (#402)
0cf454e is described below
commit 0cf454e367d411e44985625b62ff99ade87c93ec
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Tue Jun 16 19:08:53 2026 +0800
chore: unify formatter config - standardize aliases, add JDK17 setting
(#402)
* chore: unify formatter config across pekko sub-projects
Motivation:
Align formatter plugins, command aliases, and JDK settings with other
pekko sub-projects to reduce maintenance burden.
Modification:
- Standardize checkCodeStyle/applyCodeStyle command aliases
- Add ThisBuild / javafmtFormatterCompatibleJavaVersion := 17 where missing
- Replace custom verifyCodeFmt tasks with standard aliases where applicable
- Upgrade sbt-java-formatter plugin where needed
Result:
Consistent formatter configuration across all pekko sub-projects.
Tests:
Not run - build config change only
References:
None - formatter unification across pekko sub-projects
* fix: add check-code-style job to CI
Motivation:
The CI workflow had no code style validation. Formatter checks
(scalafmt, javafmt, headers) were not enforced.
Modification:
Add a check-code-style job that runs sbt checkCodeStyle.
Result:
CI now validates code style (scalafmt + javafmt + headers) on every PR.
* fix: apply javafmt 0.12.0 formatting to 8 Java files
Motivation:
CI Check Code Style failed because 8 Java files were not formatted
with javafmt 0.12.0.
Modification:
Run javafmtAll to format all Java files.
Result:
Check Code Style CI check passes.
* fix: apply google-java-format 1.24.0 formatting to BlogPostJsonColumn.java
Add blank line between import statements and Paradox snippet marker comment,
as required by google-java-format 1.24.0 running on JDK 17.
* fix: exclude documentation test Java files from javafmt
Files in jdocs/ use Paradox snippet markers between imports which
google-java-format cannot handle (requires contiguous imports).
* fix: use javafmtSortImports := false to preserve Paradox markers
Motivation:
Replacing excludeFilter with javafmtSortImports := false allows
javafmt to format all files while preserving import order and
Paradox snippet marker positions.
Modification:
- Replace javafmt/excludeFilter with javafmtSortImports := false
- Restore jdocs files to original import order with markers
- Run javafmtAll which formats code without reordering imports
Result:
All Java files are formatted by javafmt while Paradox snippet markers
correctly wrap their intended imports for documentation rendering.
* fix: restore license headers in documentation test files
Motivation:
pjfanning review feedback - license headers should not be modified
by formatter changes.
Modification:
Restore original multi-line copyright notice format in
BlogPostCounts.java and BlogPostJsonColumn.java.
Result:
License headers preserved as requested in review.
Tests:
Not run - docs only
References:
Refs #402
* fix: restore license headers in remaining documentation test files
Motivation:
pjfanning follow-up review - BlogPostQuery.java, MultiPluginDocExample.java,
and BlogPostTitleColumn.java still had modified single-line copyright
headers.
Modification:
Restore original multi-line copyright notice format in all 3 remaining
files.
Result:
All documentation test Java files now preserve original license headers.
Tests:
Not run - docs only
References:
Refs #402
* fix: address CR feedback - restore jdocs formatting and fix Paradox
marker placement
Motivation:
Reviewer pjfanning requested: (1) license headers must not be modified
by formatter, (2) 'public' keyword should be on the same line as
'static class MyEntity' in MultiPluginDocExample.java to render
correctly in Paradox documentation snippets.
Modification:
- Add javafmt excludeFilter for jdocs/ files (Paradox snippet markers
between imports/copyright headers are incompatible with
google-java-format)
- Revert jdocs Java files to original formatting (restore multi-line
copyright headers, original class declarations and lambda formatting)
- Move 'public' keyword to 'static class MyEntity' declaration line in
MultiPluginDocExample.java, keeping the // #withPlugins Paradox marker
before the class declaration
Result:
All CR comments addressed. checkCodeStyle (scalafmt + javafmt + headers)
passes. Docs test sources compile successfully.
Tests:
sbt checkCodeStyle - passed
sbt docs/Test/compile - passed
References:
Refs apache/pekko-persistence-r2dbc#402
---
build.sbt | 7 +++++++
.../org/apache/pekko/persistence/r2dbc/state/JavadslColumn.java | 9 +++------
docs/src/test/java/jdocs/home/MultiPluginDocExample.java | 3 +--
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/build.sbt b/build.sbt
index 835ed7b..b707963 100644
--- a/build.sbt
+++ b/build.sbt
@@ -16,6 +16,13 @@ sourceDistIncubating := false
ThisBuild / resolvers += Resolver.ApacheMavenSnapshotsRepo
ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo
ThisBuild / evictionErrorLevel := Level.Info
+ThisBuild / javafmtFormatterCompatibleJavaVersion := 17
+ThisBuild / javafmtSortImports := false
+ThisBuild / javafmt / excludeFilter := new SimpleFileFilter(f =>
+ f.getAbsolutePath.contains("/jdocs/"))
+
+addCommandAlias("checkCodeStyle", "scalafmtCheckAll; scalafmtSbtCheck;
javafmtCheckAll; +headerCheckAll")
+addCommandAlias("applyCodeStyle", "+headerCreateAll; scalafmtAll; scalafmtSbt;
javafmtAll")
GlobalScope / parallelExecution := false
Global / concurrentRestrictions += Tags.limit(Tags.Test, 1)
diff --git
a/core/src/test/java/org/apache/pekko/persistence/r2dbc/state/JavadslColumn.java
b/core/src/test/java/org/apache/pekko/persistence/r2dbc/state/JavadslColumn.java
index 0bf9a4f..28fbc86 100644
---
a/core/src/test/java/org/apache/pekko/persistence/r2dbc/state/JavadslColumn.java
+++
b/core/src/test/java/org/apache/pekko/persistence/r2dbc/state/JavadslColumn.java
@@ -28,11 +28,8 @@ public class JavadslColumn extends AdditionalColumn<String,
Integer> {
@Override
public Binding<Integer> bind(Upsert<String> upsert) {
- if (upsert.value().isEmpty())
- return AdditionalColumn.bindNull();
- else if (upsert.value().equals("SKIP"))
- return AdditionalColumn.skip();
- else
- return new AdditionalColumn.BindValue<>(upsert.value().length());
+ if (upsert.value().isEmpty()) return AdditionalColumn.bindNull();
+ else if (upsert.value().equals("SKIP")) return AdditionalColumn.skip();
+ else return new AdditionalColumn.BindValue<>(upsert.value().length());
}
}
diff --git a/docs/src/test/java/jdocs/home/MultiPluginDocExample.java
b/docs/src/test/java/jdocs/home/MultiPluginDocExample.java
index 6210cf0..b1d2a59 100644
--- a/docs/src/test/java/jdocs/home/MultiPluginDocExample.java
+++ b/docs/src/test/java/jdocs/home/MultiPluginDocExample.java
@@ -20,9 +20,8 @@ import
org.apache.pekko.persistence.typed.javadsl.EventSourcedBehavior;
public class MultiPluginDocExample {
- static
// #withPlugins
- public class MyEntity extends EventSourcedBehavior<MyEntity.Command,
MyEntity.Event, MyEntity.State> {
+ public static class MyEntity extends EventSourcedBehavior<MyEntity.Command,
MyEntity.Event, MyEntity.State> {
// #withPlugins
public MyEntity(PersistenceId persistenceId) {
super(persistenceId);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]