Skip to content

style: format the Java code - #109

Merged
uniqueg merged 2 commits into
devfrom
style/java-format
Nov 7, 2026
Merged

uniqueg merged 2 commits into
devfrom
style/java-format

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR reformats the hand-written Java code. It is the first of three PRs for #85:

  1. This reformat.
  2. Adding its squash commit to .git-blame-ignore-revs. Please squash-merge this PR, so that there is a single commit to add.
  3. The formatter and linter configuration in pom.xml (Spotless, Checkstyle set up to match the formatter), with the CI job. The third PR resolves the issue.

Commits

  • docs: prepare the Javadoc for the formatter changes comments only:
    • Class descriptions now come before their @author tag. Otherwise the formatter folds them into the tag.
    • The lists in ExecutorCommandWrapper, CustomErrorHandler, SingleTaskStrategy and TaskListStrategy are written as HTML lists, and a missing sentence break in TesKubernetesConverter is added.
    • The {@link} in GroupNamesSecurityExtractor is qualified. Before, only an unused import resolved it.
  • style: format the Java code:
    • Formatter: google-java-format 1.7 in AOSP style, through spotless-maven-plugin 2.30.0, with unused imports removed.
    • Why AOSP: it keeps the 4-space indentation the code already uses, with a limit of 100 columns. The default Google style would re-indent every line.
    • Why these versions: they are the last that run on Java 8, the JDK of the build and CI.
    • Scope: src/main/java, src/test/java and src/integration-test/java.
    • Excluded: only the generated files, as listed in src/main/java/.openapi-generator/FILES: tes/api/ApiUtil, TasksApi, ServiceInfoApi, tes/model/Service* and Tes*.
    • The hand-written controllers in tes/api and tes/model/TaskView are formatted. The two controllers are kept out of code generation by .swagger-codegen-ignore.

Not changed:

  • No file other than .java sources changes.
  • The long JSON string literals in the integration tests stay as they are: the formatter doesn't break strings.
  • Wildcard imports stay; they are for PR 3.
  • Until PR 3 lands, nothing enforces the formatting. Branches merged in between should be formatted again.

Part of #85.

Verification

  • Formatting only:

    • I ran ./mvnw clean test-compile on dev and on this branch, then dumped every class in target/classes and target/test-classes with javap -c -p -constants. That covers all 127 classes: main, unit test and integration test.
    • The two dumps are identical. Line-number tables are left out, because reformatting moves lines.
    • The adversarial reviewer also compared the code tokens of every changed file, keeping string literals exact. The only differences are the modifier order final static → static final and the removed imports.
  • ./mvnw verify on Java 8 (Temurin 8.0.504) passes: 7314 unit tests and 53 integration tests.

  • To reproduce: add the Spotless configuration of PR 3 to pom.xml and run ./mvnw spotless:apply.

  • Review: two rounds with the adversarial and quality reviewers.

    • In round 1, the quality reviewer found that the Javadoc was reflowed and that whole packages were excluded. Both are fixed: the first commit fixes the Javadoc, and only the generated files are excluded now.
    • In round 1, the adversarial reviewer found the broken {@link}, now fixed.
    • In round 2, both reviewers found descriptions still folded into @author (CustomErrorHandler, User) and numbered lists joined into paragraphs. All are fixed in the first commit. No description follows an @author tag any more.
  • CI: all jobs pass and the gate CI passed is green.

    • codecov/patch fails, as expected for a reformat. It treats every reformatted line as changed, including lines that no test covers. The check isn't required; codecov/project passes.
    • Sourcery skipped the review: the diff is over its limit of 500,000 characters.

Declined review findings

  • Adversarial, low: about 20 long // comments are wrapped into short fragments. The meaning is unchanged; left as is.
  • Quality, low: break up the long JSON literals in the integration tests, and expand the wildcard imports. Left for later. They are not formatting, and PR 3 handles them (Checkstyle LineLength and AvoidStarImport).

Open questions

None.

🤖 Generated with Claude Code

uniqueg and others added 2 commits November 7, 2026 17:26
Put class descriptions before their @author tag, so that the formatter
doesn't fold them into the tag; write the lists (executor command rules,
error handler, order of builder calls) as HTML lists; add a missing
sentence break; qualify the {@link} that only an unused import resolved.

Refs #85

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Format all hand-written Java code (main, test and integration test
sources, except the generated files listed in
src/main/java/.openapi-generator/FILES) with google-java-format 1.7 in
AOSP style (4-space indentation, as before), through
spotless-maven-plugin 2.30.0, and remove unused imports.

Formatting only: the bytecode of all 127 compiled classes is identical
before and after (javap -c -p -constants).

Refs #85

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg marked this pull request as ready for review November 7, 2026 16:30
@sourcery-ai

sourcery-ai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Sorry @uniqueg, your pull request is larger than the review limit of 500,000 diff characters

@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.18933% with 57 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.16%. Comparing base (c569334) to head (a0b7def).

Files with missing lines Patch % Lines
.../java/uk/ac/ebi/tsc/tesk/config/security/User.java 42.85% 8 Missing and 8 partials ⚠️
...i/tsc/tesk/k8s/convert/TesKubernetesConverter.java 92.64% 9 Missing and 1 partial ⚠️
...tsc/tesk/config/TraceInterceptorConfiguration.java 46.66% 8 Missing ⚠️
.../tsc/tesk/k8s/service/KubernetesClientWrapper.java 84.00% 7 Missing and 1 partial ⚠️
...sc/tesk/k8s/convert/KubernetesObjectsSupplier.java 93.33% 0 Missing and 7 partials ⚠️
.../tsc/tesk/k8s/convert/TaskmasterEnvProperties.java 0.00% 0 Missing and 2 partials ⚠️
...uk/ac/ebi/tsc/tesk/tes/service/TesServiceImpl.java 95.00% 0 Missing and 2 partials ⚠️
.../uk/ac/ebi/tsc/tesk/config/CustomErrorHandler.java 94.44% 0 Missing and 1 partial ⚠️
...onfig/security/CustomAuthenticationEntryPoint.java 93.33% 1 Missing ⚠️
...tesk/config/security/ElixirPrincipalExtractor.java 98.48% 0 Missing and 1 partial ⚠️
... and 1 more

❌ Your patch check has failed because the patch coverage (90.18%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #109      +/-   ##
==========================================
+ Coverage   57.73%   62.16%   +4.42%     
==========================================
  Files          64       64              
  Lines        2191     2471     +280     
  Branches      245      257      +12     
==========================================
+ Hits         1265     1536     +271     
- Misses        786      794       +8     
- Partials      140      141       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg merged commit 5ba7f6c into dev Nov 7, 2026
28 of 34 checks passed
@uniqueg
uniqueg deleted the style/java-format branch November 7, 2026 16:48
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