-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generated preconditions not correctly formatted #94
Comments
Thanks for the report! Can see how this is frustrating when debugging the generated recipe. We seem to already pass in an indentation argument when we join preconditions, but it'll need a closer look to know exactly where we're missing a level of indentation. Lines 545 to 609 in 6fef187
|
Just from a short look I would think that line 608 is wrong (specifically the String.join(...) part). For nested calls the elements of the preconditions collection can be multiline strings. Therefore each of those elements would have to be split to lines, indented and joined again, not just the collection as a whole. Right now only the first line of a multiline string would be indented. |
Thanks yes looks like it; had a brief look at changing the indentation, but no immediate fix from a quick attempt yet. |
This has been revised in #120 |
What is the smallest, simplest way to reproduce the problem?
Look at the locally generated RedundantCallRecipe.java for https://github.com/openrewrite/rewrite-migrate-java/blob/c223f325b13c1deb96eb96d6a6c9ff7570e5563c/src/main/java/org/openrewrite/java/migrate/lang/StringRules.java#L29-L33.
What did you see instead?
It contains this precondition:
The indentation inside the nested "AND" is wrong. This doesn't break the rewrite functionality, but it made me look for an error in the precondition generation which is not even there (I read this as two times the same top level condition and looked for why the duplicate is not recognized). :/
Are you interested in contributing a fix to OpenRewrite?
Maybe.
The text was updated successfully, but these errors were encountered: