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 Recipe that allows for the removal/negation of gitignore rules. #4610

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

Conversation

Jenson3210
Copy link
Contributor

What's changed?

Added a recipe

What's your motivation?

First iteration of this seems to work well.

Anyone you would like to review specifically?

@timtebeek as discussed

Have you considered any alternatives or workarounds?

FindAndReplaceText is very restrictive on this. This really uses gitignore rules/logic to determine if a change to the gitignore is necessary.

Any additional context

I've added a workaround for openrewrite/jgit#3
In a next iteration, I want to remove this workaround again once jgit is fixed but guessing we will have some longer checks there.
Planning on 2 later iterations:

  • removeEmptyGitignoreFile boolean option that removes a file if the last gitignore entry was removed or it only contains comments/empty lines after changes.
  • support wildcard filepaths or directories with wildcard as input: This should match all files matching and for each of these files calculate same negations. Instead of iteration over paths variable, we iterate over all files matching the paths wildcard variables.

Checklist

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

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@Jenson3210
Copy link
Contributor Author

Jenson3210 commented Oct 25, 2024

Thanks @timtebeek, did not get the time for the suggestions yet today. Would've done it otherwise :)

About this build failure...
Looks like it got introduced by this suggestion not updating the parameter name but only the variable usage?
Screenshot 2024-10-25 at 14 08 15

Anyhow pushed a change that uses ctx

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.

2 participants