CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 47
Releases: numtide/treefmt
v2.3.1
f24fc53
Compare
Bugfixes
- automatic resolution of the tree root with
git rev-parse --show-toplevel
was only being applied whenwalk
was set togit
and notauto
.
Nixpkgs PR Tracker
https://nixpkgs-tracker.ocfox.me/?pr=409400
Changelog
- f24fc53: Merge pull request #588 from numtide/fix/default-tree-root-cmd (@brianmcgee)
- 288ee07: fix: better logic for tree-root-cmd defaulting when walk is auto (@brianmcgee)
Assets 8
v2.3.0
60f791c
Compare
Features
- you can now specify the tree root with a command
--tree-root-cmd
orTREEFMT_TREE_ROOT_CMD
. When using thegit
walker, if no other tree root has been specified, it will default togit 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
- 3c8acf4: Fix broken link (@jfly)
- a22a307: Fix when tree root is symlink (@9999years)
- b97672a: feat: find tree root via a user-specified command (@brianmcgee)
- 1c19088: fix(deps): update module github.com/charmbracelet/log to v0.4.2 (@renovate[bot])
- 11ea13e: fix(deps): update module golang.org/x/sync to v0.14.0 (@renovate[bot])
- b74fbb4: fix(deps): update module golang.org/x/sys to v0.33.0 (@renovate[bot])
Assets 8
v2.2.1
9399cd6
Compare
Bugfixes
- respect
.gitignore
when traversing untracked files ingit
walker.
Nixpkgs PR Tracker
https://nixpkgs-tracker.ocfox.me/?pr=397034
Changelog
Assets 8
v2.2.0
0773976
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 configuretreefmt
with nix, there are now
treefmt.withConfig
andtreefmt.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
andfish
, 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 dumbtty
.
Nixpkgs PR Tracker
https://nixpkgs-tracker.ocfox.me/?pr=394906
Changelog
- 621144f: better error if command cannot be found (@Mic92)
- 855eb9a: docs(README): update motivation (@zimbatm)
- f4336fd: feat(docs): auto-generate usage snippet (@brianmcgee)
- 583681d: feat(docs): improve docs package (@brianmcgee)
- 5861604: feat(docs): refine setup (@brianmcgee)
- 3828aaf: feat(docs): rename content directory to site (@brianmcgee)
- b0731a2: feat: add
withConfig
&buildConfig
from nixpkgs (@MattSturgeon) - 10c9a72: feat: add a quiet flag to suppress all output except for errors (@brianmcgee)
- b76d839: feat: change default log level for unmatched to INFO instead of WARN (@brianmcgee)
- 43f943f: feat: enforce formatter name format (@brianmcgee)
- 30e1ecd: feat: improve error handling in format Run method (@brianmcgee)
- d182c6d: feat: log the config file used at DEBUG level instead of INFO (@brianmcgee)
- 21cefd7: feat: print stats to stderr instead of stdout (@brianmcgee)
- 9662ee6: feat: traverse untracked files in git walker (@brianmcgee)
- d17a8d6: feat: update to go 1.24 (@brianmcgee)
- e90b952: fix(go): update termenv to v0.16.0 (@zimbatm)
- d82a9fc: fix: bad usage of require.Errorf (@brianmcgee)
- ce65379: fix: ignoring symlinks (#528) (@gabyx)
- bbf3177: fix: move path resolution logging to debug instead of error (@brianmcgee)
- 2503227: fix: shell completions (@brianmcgee)
Assets 8
v2.1.1
741970b
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
- f8a1f44: README: fix coverage branch (@brianmcgee)
- d535b1d: README: new format (@zimbatm)
- e41339a: README: remove Rust to Go section (@brianmcgee)
- 3aaaf7c: README: remove golangci-lint workflow (@brianmcgee)
- 6698ee6: fix: bad links in README.md (@o-az)
- ab89e0b: fix: exiting with error if formatters fail (@brianmcgee)
- 887e9e9: fix: more bad links in README.md (@o-az)
- 91aef76: fix: non-ascii paths in git walker (@brianmcgee)
- a0be22d: fix: set go module to v2 (@brianmcgee)
- d5a39b0: fixup! fix: non-ascii paths in git walker (@brianmcgee)
Assets 8
v2.1.0
cab1a29
Compare
Better configuration
We replaced kong with cobra+viper for cli processing and configuration.
This brings two new features:
- Option overrides with environment variables.
- 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
- d7c1064: Avoid hanging: ensure we always close
f.filesCh
(@jfly) - e47674d: Clarify in the spec that the formatter MUST process the given files (@jfly)
- 962d695: ci: add mergify config (@brianmcgee)
- 94c53c5: ci: run golangci-lint as a flake check instead of github workflow (@brianmcgee)
- c131adc: feat: add connect timeout to bolt db (@brianmcgee)
- 45592a9: feat: add test helper for changing work directory (@brianmcgee)
- b834fa3: feat: best-effort application of files to formatters (@brianmcgee)
- 6bfe249: feat: bump golangci-lint version to 1.61.0 in github workflow (@brianmcgee)
- 6cadbbc: feat: create a separate docs devshell (@brianmcgee)
- b956dcd: feat: improve cache busting test (@brianmcgee)
- 9e45e55: feat: improve cache test (@brianmcgee)
- d7c39b6: feat: improve change detection (@brianmcgee)
- 9d9ea4e: feat: improve change working directory test (@brianmcgee)
- 500c356: feat: improve cpu profile test (@brianmcgee)
- 13849f2: feat: improve fail on change test (@brianmcgee)
- e32b5a2: feat: improve fail on change test (@brianmcgee)
- 782c7a0: feat: improve git test (@brianmcgee)
- 5659267: feat: improve missing formatter test (@brianmcgee)
- 57abb78: feat: improve paths handling (@brianmcgee)
- d0f5990: feat: improve prj root env test (@brianmcgee)
- 40e18a3: feat: improve specifying formatters test (@brianmcgee)
- 7a717ec: feat: improve unmatched test (@brianmcgee)
- 39774dc: feat: log treefmt command and output in tests (@brianmcgee)
- 71b262f: feat: match before checking cache (@brianmcgee)
- fc88f98: feat: more stringent golangci-lint rules (@brianmcgee)
- 21fbdc0: feat: refactor caching approach (@brianmcgee)
- ca655f5: feat: refactor processing (@brianmcgee)
- 66bdc82: feat: refine deterministic order test (@brianmcgee)
- 45ed5e8: feat: refine includes/excludes test (@brianmcgee)
- bda4138: feat: refine paths arg test (@brianmcgee)
- 41712b5: feat: refine run in subdir test (@brianmcgee)
- 9d53c96: feat: refine stdin test (@brianmcgee)
- 9fc9e67: feat: refine treefmt helper api in test (@brianmcgee)
- 9d521a9: feat: refine treefmt test helper (@brianmcgee)
- 48d4b4b: feat: remove globals from stats package (@brianmcgee)
- 202acb9: feat: remove relative path optimization in filesystem walker (@brianmcgee)
- bac4a0d: feat: replace kong with cobra/viper (@brianmcgee)
- 5d3de7c: feat: simplify .envrc (@brianmcgee)
- d195f79: feat: simplify devshell (@brianmcgee)
- 844f3fd: feat: simplify git walking (@brianmcgee)
- 93c8343: feat: simplify stats recording in filesystem reader (@brianmcgee)
- 8701a8f: feat: update flake inputs (@brianmcgee)
- 0ee561e: fix: correct handling of absolute and relative paths (@jfly)
- 4f1f3d6: fix: do not cache formatting errors (@brianmcgee)
- 6824497: fix: duplicate iota in walk.Type enum (@brianmcgee)
- 8aeee1d: fix: exit with error if any formatters fail (@brianmcgee)
- df4de90: fix: formatter_test (@brianmcgee)
- 2d3398c: fix: git module domain (@brianmcgee)
- f6d1b13: fix: golanci-lint workflow (@brianmcgee)
- 7740e3a: fix: gomod2nix.toml (@brianmcgee)
- 9ce6522: fix: normalize and enforce stdin paths as well (@jfly)
- 147dcdb: fix: path handling and checking git index (@brianmcgee)
- 5306a5e: fix: resolve commands relative to the root (@zimbatm)
- db7b305: fix: unmatched reporting global excludes (@brianmcgee)
- d490e98: fix: use PRJ_ROOT to find config (@brianmcgee)
Assets 8
v2.0.5
9c13b18
Compare
Bugfixes
- 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 asshellcheck
orshfmt
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
- c53a1f1: feat: log changed files at error level when --fail-on-change is enabled (@brianmcgee)
- a581352: fix: Do not exclude executables in git walker (@akshaymankar)
- 1734bcf: fix: remove assertFormatted, use assertStats instead (@brianmcgee)
Nixpkgs PR Tracker
Assets 8
v2.0.4
31e363d
Compare
Bugfixes
- 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.
- Searching for
.treefmt.toml
and relying on$PRJ_ROOT
have been re-introduced for parity withv1
. - 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 agit
checkout and subsequenttreefmt
invocation were occurring.
Changelog
- 52d8c48: Update nixpkgs.toml (@mattalxndr)
- 17c1785: Update treefmt.toml (@mattalxndr)
- d4aaba9: feat: ci mode (@brianmcgee)
- 0a8ffe0: feat: move filtering of directories and symlinks into walker implementations (@brianmcgee)
- ff8b1ed: feat: refactor relative path function for filesystem walker (@brianmcgee)
- 0953dd5: feat: refactor relative path function for git walker (@brianmcgee)
- bc1ae33: feat: search for .treefmt.toml (@zimbatm)
- 43c2071: fix(cli): restore PRJ_ROOT env var (@zimbatm)
- f9bc8b0: fix(git): gracefully handle a file in the index but not in the filesystem (@brianmcgee)
- a018c29: fix: relative path resolution in filesystem walker (@brianmcgee)
Nixpkgs PR Tracker
Assets 8
v2.0.3
65152cb
Compare
Bugfixes
-
We were trying to open a cache file when using
-c --no-cache
, breaking some CI workflows. This is now handled more gracefully. -
When comparing
mod
times, we used the precision the underlying file system gave us. Some formatters, such asdos2unix
, manipulate themod
time, but not to the same precision. This was causing false positives when using--no-cache --fail-on-change
. We now truncate themod
time to second-level precision before comparing, as POSIX specifies thatmod
time should be EPOCH (second) precision. This brings us back in line withv1
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
- a642145: feat: display elapsed time to nearest millisecond (@brianmcgee)
- f266fc8: feat: if we can't open the cache, fallback to no cache (@brianmcgee)
- da7b015: feat: improve summary stats (@brianmcgee)
- 33a7bba: fix: --no-cache (@brianmcgee)
- 85ce0a2: fix: use second precision when comparing file mod times (@brianmcgee)
Nixpkgs PR Tracker
Assets 8
v2.0.2
33d2f60
Compare
Changelog
- 7d7815e: doc: fix global excludes config example (@brianmcgee)
- aea75cd: feat: remove CGO dependencies and disable (@brianmcgee)
- 986f020: feat: use numtide/blueprint instead of flake.parts (@brianmcgee)
- 2e05603: fix: configure toml tags for config fields (@brianmcgee)
- 601af09: fix: only try opening the cache if cache is enabled (@flokli)