This repository has been archived on 2024-05-03. You can view files and clone it, but cannot push or open issues or pull requests.
treefmt/docs/faq.md
Brian McGee ad3e66166a
feat: add flake compat
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-02 11:41:39 +01:00

1.1 KiB

FAQ

How does treefmt function?

Treefmt traverses all your project's folders, maps files to specific code formatters, and formats the code accordingly. Other tools also traverse the filesystem, but not necessarily starting from the root of the project.

Contrary to other formatters, treefmt doesn't preview the changes before writing them to a file. If you want to view the changes, you can always check the diff in your version control (we assume that your project is checked into a version control system).

You can also rely on version control if errors were introduced into your code as a result of disruptions in the formatter's work.

How is the cache organized?

At the moment, the cache is a BoltDB database file in which file paths are mapped to mtimes.

The file is located in:

~/.cache/treefmt/eval-cache/<hash-of-the-treefmt.toml-path>.db

At the end of each run, the database is updated with the last formatting time entries. In this way, we can compare the last change time of the file to the last formatting time, and figure out which files need re-formatting.