Skip to content

Align sample project formatters with Pekko core - #207

Open
He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:align-core-formatters
Open

He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:align-core-formatters

Conversation

@He-Pin

@He-Pin He-Pin commented Nov 12, 2026

Copy link
Copy Markdown
Member

Motivation

Align the independent sbt examples with Apache Pekko core's formatter tooling while keeping each example self-contained.

Modification

  • Configure all 17 independent sbt builds with Scalafmt 3.11.5 and sbt-scalafmt 2.6.2.
  • Provide applyCodeStyle and checkCodeStyle aliases and document their use.
  • Configure sbt-java-formatter 0.14.0 in the 4 builds containing Java sources, using the Java 17 formatter without import sorting.
  • Include MultiJvm Scala sources in the five relevant builds. Preserve the Scala 3 dialect in the Scala 3 samples.
  • Preserve Scala 2 syntax where applicable by using the Scala 2 dialect and disabling Scala 3 syntax rewrites; do not change compiler language modes.
  • Apply the corresponding formatter output without changing snippet identifiers or runtime logic. Maven-only examples are unchanged.

Result

The one-time formatter output touches 29 Java and 25 Scala source files; the remaining changes are tooling/configuration and documentation.

The examples expose consistent, self-contained formatting commands instead of relying on a checkout of the core repository.

Tests

  • JDK 17: sbt applyCodeStyle checkCodeStyle passed in all 17 independent builds, including all five MultiJvm configurations and the four Java-enabled builds.
  • pekko-sample-cluster-java: compile, MultiJvm / compile, and test passed. The distributed MultiJvm suite was compiled, not executed.
  • docs-gen: pekko-sample-cluster-java / paradox passed with the process-local JVM flag --add-opens=java.base/java.lang=ALL-UNNAMED, required by its existing Parboiled version on JDK 17. Without that compatibility flag it fails during parser initialization.
  • Verified that documentation snippet identifiers/pairs were preserved. Java token comparison preserves runtime code after accounting for formatter removal of unused imports, modifier ordering, and equivalent adjacent string-literal wrapping.
  • git diff --check passed. No CI inspection/monitoring. Other samples' full test suites were not run; all formatter workflows were exercised.
  • No new runtime source files were added. headerCreateAll was attempted in the representative sample but is unavailable (Not a valid key); no unrelated header plugin was introduced.

References

Refs #206: separate existing Scalafix OrganizeImports work; this PR does not add that tooling.

Core reference: apache/pekko 6049edf9.

Motivation:
Provide consistent, self-contained formatting across the independent sbt samples.

Modification:
Configure core Scalafmt and Javafmt versions and style, preserve Scala language modes, include MultiJvm sources, document commands, and apply formatter output.

Result:
All 17 sbt builds expose working formatting/check commands. Maven-only samples and runtime dependencies remain unchanged.

Tests:
All 17 applyCodeStyle/checkCodeStyle workflows passed on JDK 17. Cluster Java compile, MultiJvm compile and test passed. Representative Paradox generation passed with a process-local Java 17 compatibility flag. Snippet identities and normalized Java tokens checked; git diff --check passed. Other full test suites and CI were not run.

References:
Refs apache#206; core formatter configuration at 6049edf9.
@He-Pin
He-Pin force-pushed the align-core-formatters branch from af4f9ec to fb7c0fa Compare November 12, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant