Skip to content

Releases: numtide/treefmt

v2.3.1

21 May 12:33
v2.3.1
f24fc53
Compare
Choose a tag to compare

Bugfixes

  • automatic resolution of the tree root with git rev-parse --show-toplevel was only being applied when walk was set to git and not auto.

Nixpkgs PR Tracker

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

Changelog

v2.3.0

16 May 14:15
v2.3.0
60f791c
Compare
Choose a tag to compare

Features

  • you can now specify the tree root with a command --tree-root-cmd or TREEFMT_TREE_ROOT_CMD. When using the git walker, if no other tree root has been specified, it will default to git rev-parse --show-toplevel. This negates the need for --tree-root-file .git/config.

Bugfixes

  • fixes handling of the tree root when it is a symlink.

Nixpkgs PR Tracker

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

Changelog

v2.2.1

08 Apr 08:10
v2.2.1
9399cd6
Compare
Choose a tag to compare

Bugfixes

  • respect .gitignore when traversing untracked files in git walker.

Nixpkgs PR Tracker

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

Changelog

  • cca79a8: feat: respect .gitignore in git walker when traversing untracked files (@brianmcgee)
  • 0139d65: fix(deps): update module golang.org/x/sync to v0.13.0 (@renovate[bot])
  • a23fd4b: fix(deps): update module golang.org/x/sys to v0.32.0 (@renovate[bot])

v2.2.0

31 Mar 12:32
v2.2.0
0773976
Compare
Choose a tag to compare

Features

  • we now traverse untracked files in the git walker.
  • a new -q|--quiet flag has been added which will suppress all output except for errors.
  • for users who don't quiet need treefmt-nix but still want to configure treefmt with nix, there are now
    treefmt.withConfig and treefmt.buildConfig helper functions exposed directly from the package itself (NixOS/nixpkgs#390147).

Bugfixes

  • we now ignore symlinks when traversing.
  • static shell completions should now work for bash, zsh and fish, and can be generated with
    treefmt --completion <bash|zsh|fish>.
  • improved error reporting if a formatter command cannot be found.
  • we no longer hang for 10 seconds when stderr is a dumb tty.

Nixpkgs PR Tracker

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

Changelog

v2.1.1

29 Nov 13:28
v2.1.1
741970b
Compare
Choose a tag to compare

Bugfixes

  • fixes a subtle concurrency bug which can cause treefmt to not exit with an error code if a formatter fails
  • fixes emojis and other non-ASCII characters in file paths 😂

Nixpkgs PR Tracker

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

Changelog

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