Repository navigation
Fix XML attribute continuation indentation - #8659
Merged
jkschneider merged 2 commits intoAug 27, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed?
What's your motivation?
AutoFormatcould repeatedly expand the leading whitespace of continued XML attributes. The detected continuation indent included the parent tag's existing indentation, while the formatter multiplied that absolute value by the tag depth on every cycle.Anything in particular you'd like reviewers to focus on?
Please review the relative indentation calculation in
Autodetectand the handling of attribute continuations inTabsAndIndentsVisitor.Have you considered any alternatives or workarounds?
Changing only
TabsAndIndentsVisitorwould stop the multiplicative growth, but autodetection would still treat the absolute column as the continuation width and move nested attributes on subsequent cycles. The change therefore keeps detection and application consistent.Any additional context
Validated after merging the latest
mainwith:./gradlew :rewrite-xml:check(includes the completerewrite-xmltest suite, license checks, and recipe CSV validation)./gradlew :rewrite-docker:test --tests org.openrewrite.docker.search.FindEndOfLifeImagesTest.mixedEolAndCurrentgit diff --checkThe initial CI failure was limited to the unrelated
rewrite-dockerend-of-life fixture. It reproduced on the then-current upstreammainand was fixed upstream by #8661; the previously failing test now passes after syncing this branch withmain. No Docker code or tests are changed by this PR.Tests were run with configuration-on-demand and a local Java 8 toolchain on Windows.
Checklist
rewrite-xmltest and check tasks