-
Notifications
You must be signed in to change notification settings - Fork 354
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
Remove maven properties should remove comment #4554
Remove maven properties should remove comment #4554
Conversation
Thanks for the report! Makes sense to also want to remove any preceding comments; I've made it optional in |
rewrite-xml/src/main/java/org/openrewrite/xml/RemoveContentVisitor.java
Outdated
Show resolved
Hide resolved
My opinion it that is should be the default. I don't see any reason to keep existing comment when removing such tag. I see that we filter |
Since we in the end produce a diff, the developer can still decide to restore the comment, in the case that it also pertains to any subsequent elements. I would probably remove them by default. In OpenRewrite we don't have any concept of trailing comments, but I think it could be interesting to build a trait or something similar which would allow recipes that remove elements to also remove the "associated" comments, which would typically be any preceding multi-line comment and trailing single-line comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for kicking this off and the quick feedback (both) on changing the default. Applied this everywhere it made sense, except where we were replacing with a similar element.
I saw in many project maven properties with an attached comment.
When running some recipes to remove properties the comment is left behind
I don't know how to fix it but I've implemented a test that demonstrates the issue
Example when cleanup property override (that are defined on a parent pom)
I would expect the TODO comment is also gone
Anything in particular you'd like reviewers to focus on?
Some help to implement it
Have you considered any alternatives or workarounds?
Not really
Checklist