Skip to content

feat: add tabletest-formatter for Java and Kotlin#2860

Merged
nedtwigg merged 4 commits intodiffplug:mainfrom
nchaugen:feat/tabletest-formatter
Mar 2, 2026
Merged

feat: add tabletest-formatter for Java and Kotlin#2860
nedtwigg merged 4 commits intodiffplug:mainfrom
nchaugen:feat/tabletest-formatter

Conversation

@nchaugen
Copy link
Contributor

Adds native support for tabletest-formatter, which formats @TableTest tables in Java and Kotlin source files.

All configuration is read from .editorconfig files — only version is exposed in the Spotless DSL.

Follows the glue class pattern (like CleanthatJava, PalantirJavaFormat). Single Maven coordinate: org.tabletest:tabletest-formatter-core:1.0.1.

Verified: testlib:test (271 pass), spotbugsMain, plugin compilation, spotlessApply.

@nedtwigg
Copy link
Member

nedtwigg commented Mar 2, 2026

Great PR for a neat formatter!

  • Add annotations to disable your tests on Java 17
  • Add yourself into the root README and then run spotlessApply so that the inline js renders
    • spotless/README.md

      Lines 90 to 94 in bb7e7be

      lib('java.ForbidModuleImportsStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
      extra('java.EclipseJdtFormatterStep') +'{{yes}} | {{yes}} | {{yes}} | {{no}} |',
      lib('java.FormatAnnotationsStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
      lib('java.CleanthatJavaStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
      lib('json.gson.GsonStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',

- Remove unused TableTestFormatter field from glue class (fixes SpotBugs)
- Add @EnabledForJreRange(min = JAVA_21) to tests (formatter requires Java 21)
- Add TableTestFormatterStep to root README feature matrix
@nchaugen
Copy link
Contributor Author

nchaugen commented Mar 2, 2026

Thanks for the nice feedback! I've added test annotations, removed the unused field that I think upset SpotBugs, and added java.TableTestFormatterStep to the README.

@nedtwigg
Copy link
Member

nedtwigg commented Mar 2, 2026

Ah, it's a little harder than I realized. In lib/build.gradle, you'll need to exclude your tableTestFormatter from NEEDS_GLUE unless building on Java 21+. We run our deployment on Java 21+, so it will be in the deployed binaries.

@nchaugen
Copy link
Contributor Author

nchaugen commented Mar 2, 2026

I see. I made inclusion of tableTestFormatter conditional based on Java version. Would that work?

@nedtwigg nedtwigg merged commit 833a25c into diffplug:main Mar 2, 2026
20 checks passed
@nedtwigg
Copy link
Member

nedtwigg commented Mar 2, 2026

Yup :)

@nchaugen
Copy link
Contributor Author

nchaugen commented Mar 2, 2026

Awesome! Thank you so much!

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.

2 participants