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

Performance improvement: only parse files needed by active recipes #185

Closed
murdos opened this issue Jun 24, 2021 · 4 comments
Closed

Performance improvement: only parse files needed by active recipes #185

murdos opened this issue Jun 24, 2021 · 4 comments

Comments

@murdos
Copy link
Contributor

murdos commented Jun 24, 2021

Just an idea: parsing POM can be quite slow when you use a number of dependencies, but this parsing is in fact useless if you have no active recipes of Maven category.

@jkschneider
Copy link
Member

This is a really good point. I'm kind of embarrassed to say we never really thought of it. Shouldn't be a tough fix?

@murdos
Copy link
Contributor Author

murdos commented Jun 25, 2021

Indeed, that was a tough fix! 😄
Should the same logic be also applied to the gradle plugin?

@wetneb
Copy link

wetneb commented Oct 18, 2023

Is this fix still working? I am trying to run OpenRewrite on a Java codebase (https://github.com/OpenRefine/OpenRefine), activating only Java recipes, and OpenRewrite still tries to parse a lot of other files.

To reproduce:

git clone --depth 1 https://github.com/OpenRefine/OpenRefine
cd OpenRefine
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.activeRecipes=org.openrewrite.java.RemoveUnusedImports

Then, observe that the logs contain the following lines:

[WARNING] There were problems parsing some source files, run with --errors to see full stack traces
[WARNING] There were problems parsing .github/workflows/label_transfer/script.py
[INFO] Project [OpenRefine - main] Parsing source files
[INFO] Parsing as quark /tmp/OpenRefine/main/tests/data/ozone_8hr_dmax.csv as its size 14Mb exceeds size threshold 10Mb

Because the active recipe is a Java recipe, I would not expect the plugin to attempt Python or CSV files.

Alternatively it would be convenient if one could restrict the plugin to a particular list of includes (but I did not find a counterpart to <exclusions/> in the config).

@timtebeek
Copy link
Contributor

Some context also provided in this follow up issue:

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

No branches or pull requests

4 participants