Skip to content

Releases: numtide/treefmt

v2.1.0

08 Nov 11:05
v2.1.0
cab1a29
Compare
Choose a tag to compare

Better configuration

We replaced kong with cobra+viper for cli processing and configuration.

This brings two new features:

  1. Option overrides with environment variables.
  2. More options can now be configured in treefmt.toml.

The order of precedence between flags, env variables, and config is now also correct.

See here for more info.

Simpler codebase

Many improvements have been made to simplify the codebase and make it easier to follow.

In addition, we no longer rely on go-git; instead, we use git itself.

We have seen some issues with go-git and decided that it wasn't adding much value and would always remain a source of discrepancy with git itself.

Better testing

Thanks to jfly and their (sometimes excruciating 😜) attention to detail, we have fixed some bugs, refined some features, and improved the quality of testing overall.

Better documentation

It might not look as pretty as before, but we moved back to mkdocs-material.

The main driver for the change was a better story around versioning, which is being provided by mike.

Nixpkgs PR Tracker

https://nixpkgs-tracker.ocfox.me/?pr=354455

Changelog

v2.0.5

21 Aug 11:02
v2.0.5
9c13b18
Compare
Choose a tag to compare

Bugfixes

  1. When walking the filesystem with git, we were skipping executable files. There is a test which should have detected this. In this case, the test also had a bug 🤦‍♂️ Thanks to @akshaymankar for the fix. The test has also been updated. This affects users using formatters such as shellcheck or shfmt to format their executable shell scripts.

--fail-on-change improvement

We now log the path that has changed at error level, making it easier to understand why CI builds are failing.

Changelog

Nixpkgs PR Tracker

https://nixpkgs-tracker.ocfox.me/?pr=336307

v2.0.4

08 Aug 09:39
v2.0.4
31e363d
Compare
Choose a tag to compare

Bugfixes

  1. There was a naive optimisation for resolving relative paths within the walker implementations, which manifested in a few different issues. This has been refactored with a robust implementation.
  2. Searching for .treefmt.toml and relying on $PRJ_ROOT have been re-introduced for parity with v1.
  3. We were not gracefully handling the case where a file was removed from the filesystem but not yet staged. We now log a warning and continue when this happens.

New CI flag

You can now run treefmt with a --ci flag which does the following:

  • ensures INFO level logging at a minimum
  • enables --no-cache and --fail-on-change
  • introduces a small startup delay, so we do not start processing until the second after the process starts, thereby ensuring the accuracy of our change detection based on second-level mod time. This was causing intermittent failures in CI due to how fast a git checkout and subsequent treefmt invocation were occurring.

Changelog

Nixpkgs PR Tracker

https://nixpkgs-tracker.ocfox.me/?pr=333200

v2.0.3

08 Jul 08:20
v2.0.3
65152cb
Compare
Choose a tag to compare

Bugfixes

  1. We were trying to open a cache file when using -c --no-cache, breaking some CI workflows. This is now handled more gracefully.

  2. When comparing mod times, we used the precision the underlying file system gave us. Some formatters, such as dos2unix, manipulate the mod time, but not to the same precision. This was causing false positives when using --no-cache --fail-on-change. We now truncate the mod time to second-level precision before comparing, as POSIX specifies that mod time should be EPOCH (second) precision. This brings us back in line with v1 behaviour.

Summary Improvements

We have improved the summary statistics presented at the end of each run, clarifying what has happened and removing unnecessary precision in the elapsed time.

nix fmt 
traversed 116 files
emitted 116 files for processing
formatted 67 files (0 changed) in 696ms

Changelog

Nixpkgs PR Tracker

https://nixpk.gs/pr-tracker.html?pr=325465

v2.0.2

01 Jul 19:22
v2.0.2
33d2f60
Compare
Choose a tag to compare

Changelog

v2.0.0-rc5

17 Jun 08:17
v2.0.0-rc5
30d30b5
Compare
Choose a tag to compare

Changelog

v2.0.1

28 Jun 14:18
30d30b5
Compare
Choose a tag to compare

We have rewritten treefmt in Go but have tried to retain backward compatibility as much as possible.

For the most part, treefmt 2.0 should be a drop-in replacement for 1.0.

Users may find some behaviour differences in how treefmt 2.0 traverses the filesystem. Please review the new website treefmt.com for more info.

If you have any problems, please create an issue, and we will do our best to resolve it promptly.

For some background, you can read more here.

Features

  • migrated cache storage from Toml to boltdb
  • introduced the concept of walkers to make filesystem traversal extensible. It currently supports auto, git, and filesystem. You no longer have to exclude the .git directory; ' treefmtwill traverse files based on the git index if a.git` directory is detected.
  • we now guarantee only one formatter will operate on a given path at any time.
  • ordering for formatters can now be controlled with a new priority field.
  • improved performance by up to 8x when cached based on a nixpkgs benchmark
  • migrated docs from mkdocs to vitepress
  • docs are now hosted under a custom domain, treefmt.com

Changelog

Read more

v2.0.0-rc4

06 Jun 07:47
v2.0.0-rc4
ab2b373
Compare
Choose a tag to compare
v2.0.0-rc4 Pre-release
Pre-release

Changelog

v2.0.0-rc3

29 May 14:29
v2.0.0-rc3
0223983
Compare
Choose a tag to compare
v2.0.0-rc3 Pre-release
Pre-release

Changelog

v2.0.0-rc2

17 May 11:08
v2.0.0-rc2
a20db20
Compare
Choose a tag to compare
v2.0.0-rc2 Pre-release
Pre-release

Changelog