Skip to content
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

Merged
merged 2 commits into from
Mar 9, 2023

Conversation

ematipico
Copy link
Contributor

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:

  • we don't cache when a file is ignored, so we need to check it every single time;
  • we end up traversing even ignored folders like 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 and dist folders are not traversed.

Documentation

  • The PR requires documentation
  • I will create a new PR to update the documentation

@netlify
Copy link

netlify bot commented Mar 8, 2023

Deploy Preview for docs-rometools canceled.

Name Link
🔨 Latest commit 7f6e955
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/6408659ce4688500087a44b1

@ematipico ematipico added A-CLI Area: CLI A-Project Area: project configuration and loading labels Mar 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-CLI Area: CLI A-Project Area: project configuration and loading
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant