dprint / dprint

Pluggable and configurable code formatting platform written in Rust.

Home Page:https://dprint.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Compiled regex exceeds size limit of 10485760 bytes."

bradzacher opened this issue · comments

Version: 0.41.0

One of our engineers tried to do a format of a folder with a relative glob today:
dprint fmt -- ./folder/path/**/*.ts

This glob was expanded by zsh to a set of ~2600 paths.
Of these paths around 2200 of them were ignored files (they were within node_modules :sigh:).
The dprint CLI quickly dies out with the following error:

Compiled regex exceeds size limit of 10485760 bytes.

As this is an opaque error message, the bug was reported to us to investigate.

I'm assuming that the error occurs because the glob is expanded to a set of relative paths. We haven't seen this issue before on our CI pipelines (which regularly pass well over 2.6k paths) - but I assume that we don't see it because they're always absolute paths?

As a workaround we advised the engineer to always quote their globs to prevent expansion.

I'm not sure if you have an insight into where this error message might originate - but it would be great if we could catch it to provide a clearer message.

There are some optimizations that could be made here, but yeah that's good advice to quote it beforehand.