Skip to content

treefmt shows incorrect processed file count #645

@winterqt

Description

@winterqt

Describe the bug

When running treefmt (v2.3.1, but will try on latest) on Nixpkgs (and probably some other mysterious condition being met), one file changing results in three formatters running against it, and treefmt saying that three files changed.

To Reproduce

Steps to reproduce the behavior:

  1. Checkout Nixpkgs at 592e2df8c634550a32a379e84b0e9034a996fb2c
  2. Run treefmt from its devshell
  3. Edit pkgs/build-support/rust/hooks.nix

Expected behavior

For it to say one file processed.

System information

treefmt v2.3.1, aarch64-darwin

Additional context

DEBU formatter | keep-sorted: executing: /nix/store/6gvpcjf7la0dj32bk9wwxfrkmyymrcf7-keep-sorted-0.6.1/bin/keep-sorted pkgs/build-support/rust/hooks/default.nix pkgs/build-support/rust/hooks/default.nix pkgs/build-support/rust/hooks/default.nix
INFO formatter | keep-sorted: 3 file(s) processed in 10.7595ms
DEBU formatter | nixfmt: executing: /nix/store/259h47ik5j1j9qfsxc2lybj7il3yafda-nixfmt-1.0.0/bin/nixfmt pkgs/build-support/rust/hooks/default.nix pkgs/build-support/rust/hooks/default.nix pkgs/build-support/rust/hooks/default.nix
INFO formatter | nixfmt: 3 file(s) processed in 51.175583ms
DEBU formatter | editorconfig-checker[1]: executing: /nix/store/8pq7b2sxvvk5z6awx5mwvp38as64rrkc-editorconfig-checker-3.3.0/bin/editorconfig-checker -disable-indent-size pkgs/build-support/rust/hooks/default.nix pkgs/build-support/rust/hooks/default.nix pkgs/build-support/rust/hooks/default.nix
INFO formatter | editorconfig-checker[1]: 3 file(s) processed in 15.905041ms
DEBU file has changed path=pkgs/build-support/rust/hooks/default.nix prev_size=4318 prev_mod_time="2025-11-04 20:57:31 -0500 EST" current_size=4322 current_mod_time="2025-11-04 21:00:07 -0500 EST"
DEBU file has changed path=pkgs/build-support/rust/hooks/default.nix prev_size=4318 prev_mod_time="2025-11-04 20:57:31 -0500 EST" current_size=4322 current_mod_time="2025-11-04 21:00:07 -0500 EST"
DEBU file has changed path=pkgs/build-support/rust/hooks/default.nix prev_size=4318 prev_mod_time="2025-11-04 20:57:31 -0500 EST" current_size=4322 current_mod_time="2025-11-04 21:00:07 -0500 EST"
traversed 48991 files
emitted 44241 files for processing
formatted 3 files (3 changed) in 2.231s
DEBU no more files to read

(this was when I made a change that nixfmt would catch, but there’s no reason for the other two to count towards the count since it’s all on one file)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions