Skip to content

Fix TableTest editorconfig caching and adds config fallbacks#2893

Merged
nedtwigg merged 4 commits intodiffplug:mainfrom
bric3:pick-up-editorconfig-changes-and-fallbacks
Apr 18, 2026
Merged

Fix TableTest editorconfig caching and adds config fallbacks#2893
nedtwigg merged 4 commits intodiffplug:mainfrom
bric3:pick-up-editorconfig-changes-and-fallbacks

Conversation

@bric3
Copy link
Copy Markdown
Contributor

@bric3 bric3 commented Mar 20, 2026

Fix tableTestFormatter's .editorconfig cache bug: It had a s tatic EditorConfigProvider field, the formatter could not see changes in the .editorconfig, as Gradle daemon is reused across invocations. Concretely, when the .editorconfig file changed between Gradle daemon runs, the stale cached config could cause oscillating formatting (e.g., indent inserted then removed on subsequent runs).

Also, to handle a missing .editorconfig file, this PR allows configuring the fallback values instead of always 4 spaces : tableTestFormatter().withIndentStyle("space").withIndentSize(2). This put the gradle implementation on par withthe maven one that already has this: <indentStyle>space</indentStyle><indentSize>2</indentSize>.

bric3 added 3 commits March 20, 2026 16:57
The issue is that when editoconfig changes, it was not captured by the
formatter function, because the `EditorConfigProvider` was static.
And currently `EditorConfigProvider` uses internally an ec4j
"permanent" cache:

```
ResourcePropertiesService.builder().cache(Caches.permanent()).build();
```
The fallback can be used when the `.editorconfig` is absent.
@bric3 bric3 force-pushed the pick-up-editorconfig-changes-and-fallbacks branch from 6d83cee to 96069a8 Compare March 20, 2026 17:23
@bric3 bric3 marked this pull request as ready for review March 20, 2026 17:24
@nedtwigg nedtwigg merged commit 83b5011 into diffplug:main Apr 18, 2026
20 checks passed
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