This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
fix(rome_cli): prevent exploration of ignored directories #4276
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR changes how the traversal works, making the traversal more aware of the ignored paths.
At the moment, Rome tries to traverse all ignored paths, and we check if the single file is ignored. This is very inefficient for two reasons:
dist/
,target/
, etc., all folders that have built artefacts;With this PR, I added a new method to the workspace to check if the path is ignored and changed the
can_handle
function to take into consideration directories. If a directory is ignored, then we stop the traversal.This changes how the ignored paths should be expressed. I had to change the paths in our
rome.json
. Because of that, I consider this fix a BREAKING CHANGE.On the other hand, this fix will improve the performance of our traversal logic :)
Test Plan
Current tests should pass.
I tested locally that
node_modules
,target
anddist
folders are not traversed.Documentation