Skip to content

DeleteProperty: remove comments associated with the property deleted #5747

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

xLitil
Copy link
Contributor

@xLitil xLitil commented Jul 12, 2025

What's changed?

New property named removePropertyComments added to org.openrewrite.properties.DeleteProperty that
remove all comments found before the property to removed. By convention, empty line is used to indicate start of property comments

Example, before :

# Heading comment

# Another heading comment

# delete.me comment (previous empty line indicate property comment starts)
# on
# multiple line
delete.me = baz
# After comment 1
keep.me=yes
# After comment 2

After

# Heading comment

# Another heading comment

# After comment 1
keep.me=yes
# After comment 2

What's your motivation?

Remove comments associated with the property deleted an avoid to keep this obsoletes comments.

Anything in particular you'd like reviewers to focus on?

Unit test coverage

Have you considered any alternatives or workarounds?

I search but found no alternative.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@timtebeek timtebeek self-requested a review July 16, 2025 17:39
@timtebeek timtebeek moved this from In Progress to Ready to Review in OpenRewrite Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready to Review
Development

Successfully merging this pull request may close these issues.

1 participant