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 ability to export dataTables #310

Merged

Conversation

ryanwalker
Copy link
Contributor

@ryanwalker ryanwalker commented Jul 19, 2024

What's changed?

Added the ability to export data tables.

What's your motivation?

I was reading about them in the docs and found that they were only implemented in maven and there was a request to add them to the gradle plugin.

I did see that this open issue that talks about adding some configuration that would allow you more control over turning certain csv exports on or off. From a cursory look, it seems like I might have to change rewrite-core for that to work. I'm not opposed to doing that, but I thought I'd create this PR to get thoughts before moving too far forward.

I did not add any tests yet either. I'll be more than happy to update this to a prod-ready state.

I added to the RewriteExtension:

rewrite {
    exportDatatables = true
}

It defaults to false.

Here's a screenshot of the cvs file output:
image

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

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

@@ -1255,6 +1257,14 @@ protected ResultsContainer listResults(ExecutionContext ctx) {

logger.lifecycle("All sources parsed, running active recipes: {}", String.join(", ", getActiveRecipes()));
RecipeRun recipeRun = recipe.run(new InMemoryLargeSourceSet(sourceFiles), ctx);

if (extension.isExportDatatables()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This does exactly what the maven plugin does.

@timtebeek timtebeek self-requested a review July 20, 2024 00:26
@timtebeek timtebeek added the enhancement New feature or request label Jul 20, 2024
@timtebeek
Copy link
Contributor

Thanks a lot for closing the gap here. Indeed seems like a mostly straightforward add with most functionality in core. I'll take a closer look after the weekend, but suspect that we should be able to add this pretty soon next week

Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

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

Great to see! Nice how compact the changes are here.

@timtebeek timtebeek linked an issue Jul 22, 2024 that may be closed by this pull request
@timtebeek timtebeek merged commit 5632d16 into openrewrite:main Jul 22, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add support for datatables
2 participants