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 BufferedWriterCreation recipe #258

Conversation

JLLeitschuh
Copy link
Contributor

  • BufferedWriterCreation
  • SimplifyConstantTernaryExecution

Signed-off-by: Jonathan Leitschuh Jonathan.Leitschuh@gmail.com

What's your motivation?

More recipes, more better?

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

There seems to be a bug in autoFormat where the J.Literal isn't having it's prefix padding removed.

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

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

@JLLeitschuh
Copy link
Contributor Author

This PR is currently failing. It seems that autoFormat isn't working correctly in the SimplifyConstantTernaryExecution, and I have no idea what I'm doing wrong. Any insights here would be greatly appreciated.

@JLLeitschuh
Copy link
Contributor Author

Also, waiting on openrewrite/rewrite#4015 to land too for this PR

 - BufferedWriterCreation
 - SimplifyConstantTernaryExecution

Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com>
@JLLeitschuh JLLeitschuh force-pushed the feat/JLL/buffered-writer-creation-and-simplify-ternary branch from 1ef0e73 to 56a8440 Compare February 17, 2024 17:34
@timtebeek timtebeek changed the title Add Two Recipes Add BufferedWriterCreation recipe & SimplifyConstantTernaryExecution Jul 28, 2024
@timtebeek timtebeek self-requested a review July 28, 2024 21:02
timtebeek added a commit to openrewrite/rewrite that referenced this pull request Oct 27, 2024
@timtebeek timtebeek added enhancement New feature or request recipe labels Oct 27, 2024
timtebeek added a commit to openrewrite/rewrite that referenced this pull request Oct 27, 2024
* Simplify constant ternary expressions too

- For openrewrite/rewrite-static-analysis#258

* Show additional cases covered
@timtebeek timtebeek changed the title Add BufferedWriterCreation recipe & SimplifyConstantTernaryExecution Add BufferedWriterCreation recipe Oct 27, 2024
@timtebeek
Copy link
Contributor

timtebeek commented Oct 27, 2024

Thanks both! Took me a little while to get to, but I've pushed up a few small improvements to rewrite & rewrite-templating to narrow down the changes here to just a regular Refaster recipe, such that other recipes can also benefit from those improvements:

@timtebeek timtebeek merged commit d6e2331 into openrewrite:main Oct 27, 2024
2 checks passed
timtebeek added a commit to openrewrite/rewrite-java-security that referenced this pull request Oct 27, 2024
@timtebeek
Copy link
Contributor

Also added to Java security best practices: openrewrite/rewrite-java-security@9d9c9ff
Was doubting if this should be added into the OWASP top ten as well; leave that up to you @JLLeitschuh , and thanks again!

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
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants