Skip to content
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

Add RegExp support to ChangeTagValue recipe #4733

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

Conversation

anthochristen
Copy link

@anthochristen anthochristen commented Nov 29, 2024

What's changed?

Allows ChangeTagValue to take in regex in oldValue parameter.

What's your motivation?

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

Please leave your thoughts here or on the issue #4731.

Anyone you would like to review specifically?

@timtebeek? - Because I see you actively replying ;)
@gadams00 - Because, history.

Have you considered any alternatives or workarounds?

Not really. I found this to be more appealing.

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

Antho Durairaj added 3 commits November 29, 2024 00:58
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • rewrite-core/src/main/java/org/openrewrite/internal/AdaptiveRadixTree.java
    • lines 594-594
  • rewrite-core/src/main/java/org/openrewrite/internal/lang/NonNull.java
    • lines 18-18
    • lines 43-43
  • rewrite-xml/src/main/java/org/openrewrite/xml/ChangeTagValueVisitor.java
    • lines 98-98

)
);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

Impl. SAST suggestions
@anthochristen
Copy link
Author

@timtebeek / @gadams00 Can you kindly help with this change? Thanks!

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • rewrite-xml/src/main/java/org/openrewrite/xml/ChangeTagValueVisitor.java
    • lines 97-97

new ChangeTagValue("/dependency/version",
"SNAPSHOT", "RELEASE", Boolean.TRUE)
),
xml("""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xml("""
xml(
"""

new ChangeTagValue("/dependency/version",
"$", "-RELEASE", Boolean.TRUE)
),
xml("""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xml("""
xml(
"""

new ChangeTagValue("/dependency/version",
"(\\d).(\\d).(\\d)", "$1.$3.4", Boolean.TRUE)
),
xml("""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xml("""
xml(
"""

)
);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

)
);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

1 participant