numtide / treefmt

one CLI to format your repo [maintainers=@zimbatm,@brianmcgee]
https://treefmt.com
MIT License
621 stars 38 forks source link

describe how caching is implemented #215

Closed teto closed 1 year ago

teto commented 1 year ago

Is your feature request related to a problem? Please describe.

The readme mentions:

Caching the changed files: When formatters are run in a script, they process all the files they encounter, no matter whether the code has changed. This unnecessary work can be eliminated if only the changed files are formatted. treefmt caches the changed files and marks them for re-formatting.

but I would like to know more: does it cache results in a SQL db, does it use mtime/ctime ?

Describe the solution you'd like

More information about how caching works, maybe a section at https://numtide.github.io/treefmt/usage.html

adrian-gierakowski commented 1 year ago

Seems like this has been addressed: https://numtide.github.io/treefmt/faq/

teto commented 1 year ago

thanks.

zimbatm commented 1 year ago

Note how the current implementation is super crude. It's a flat file that gets read and written to. But it works surprisingly well.

Once we hit larger code bases, it would be good to replace it with a binary format, or key-value store.