Open Philzen opened 8 months ago
Thanks for the report! Not sure if you recall at this point, but was formatting otherwise consistent in that file and similar files across the project? We try to detect the style used and apply based on that, which could be thrown off if the majority of files use a different style of indentation.
@timtebeek Yes, the project very likely contained a mix of files containing tab and space indentations. Unfortunately i have no statistics the distribution of different styles in different file types in that project. Seems similar to issue https://github.com/openrewrite/rewrite-testing-frameworks/issues/412
However, the concerned file in this report example did have consistent space indentation. I would have expected the mimium requirement of an autoformatter not to change the style withing a file. Ideally it would respect .editorconfig
(which the project had) or other formatting configuration, such as a checkstyle config XML.
What version of OpenRewrite are you using?
I am using OpenRewrite v5.10.0 with rewrite-migrate-java:2.2.0
How are you running OpenRewrite?
Using the CLI command from https://docs.openrewrite.org/recipes/java/migrate/upgradetojava17:
What is the smallest, simplest way to reproduce the problem?
Have a POM.xml with 4 spaces of indentation, such as this (only showing relevant section)
What did you expect to see?
What did you see instead?
May be related to https://github.com/openrewrite/rewrite-testing-frameworks/issues/412#issuecomment-1770472830
Actually, these are two things here:
<release>
would be inserted at exactly the same position where it replaces<target>
and<source>