Skip to content

Adding recipe for adding comments to import statements #5884

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

Merged
merged 3 commits into from
Aug 11, 2025

Conversation

steve-aom-elliott
Copy link
Contributor

What's changed?

Added recipe to allow you to add a comment to an import or multiple imports depending on the pattern provided.

What's your motivation?

There are some scenarios where we're not going to be able to provide an adequate migration for the usage of a class (like HttpParams for example, because it can be populated by any number of things and has been replaced with multiple different classes depending on the usage context). In these cases, we might want to add a comment to imports of the class with some helpful links on how they might be manually replaced instead.

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

@steve-aom-elliott steve-aom-elliott self-assigned this Aug 8, 2025
@steve-aom-elliott steve-aom-elliott added enhancement New feature or request recipe Requested Recipe test provided Already replicated with a unit test, using JUnit pioneer's ExpectedToFail labels Aug 8, 2025
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Aug 8, 2025
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-gradle/src/main/java/org/openrewrite/gradle/AddDependency.java
    • lines 32-32

@steve-aom-elliott steve-aom-elliott marked this pull request as ready for review August 8, 2025 16:19
@steve-aom-elliott steve-aom-elliott moved this from In Progress to Ready to Review in OpenRewrite Aug 8, 2025
@steve-aom-elliott steve-aom-elliott force-pushed the 1378-add-comment-to-import branch from 39dd8aa to 453d17a Compare August 11, 2025 14:29
@steve-aom-elliott steve-aom-elliott force-pushed the 1378-add-comment-to-import branch from 453d17a to de70673 Compare August 11, 2025 15:05
@steve-aom-elliott steve-aom-elliott force-pushed the 1378-add-comment-to-import branch from de70673 to 586b0d2 Compare August 11, 2025 15:37
@steve-aom-elliott steve-aom-elliott merged commit c79dac5 into main Aug 11, 2025
2 checks passed
@steve-aom-elliott steve-aom-elliott deleted the 1378-add-comment-to-import branch August 11, 2025 16:04
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Aug 11, 2025
dcsekar pushed a commit to dcsekar/rewrite that referenced this pull request Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request recipe Requested Recipe test provided Already replicated with a unit test, using JUnit pioneer's ExpectedToFail
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants