This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
fix(rome_service): disallow large files from being parsed and analyzed #3339
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
Fixes #3330
This PR adds a maximum size threshold to the Workspace after which files are no longer parsed, analyzed or formatted. At the moment I've hard-coded this limit to 1 MiB, but it should be trivial to expose this limit in the configuration file or the CLI if users really want to process very large files.
As part of the new message for this new error, I've added a new
Bytes
utility torome_console
that prints a quantity in bytes using the correct binary unit (B, KiB, MiB, GiB or TiB)Test Plan
I've added new test cases for the CLI that ensures files larger than the size threshold are not checked or formatted, and the correct diagnostic is emitted.