Open x10an14 opened 4 months ago
"Taking forever" ~> 20 seconds, just to not mislead what I meant by that technical hyperbole (but then again, how many expect a linter/formatter to take more than sub two seconds).
While nixfmt
as of recently has the capability of recursing into subdirectories, usually this should be the job of the program invoking it. Therefore, you should probably take your feature request to the nix fmt
developers in your case. For reference, treefmt
has a configuration file where you can specify ignores.
Handling gitignore semantics is a highly non-trivial task, and should not be re-implemented for every language formatter.
@piegamesde I don't agree with this. It's really not that hard to support this, because we can use a library like vcs-ignore, which will be good enough for most cases.
A especially good argument for needing this is that it doesn't make sense for a formatter to accept directory arguments when it doesn't make any effort to filter those directories, because at that point you need to use another tool for filtering anyways and you'd pass files to the formatter instead.
And at that point, nixfmt
is essentially not an end-user CLI anymore, which might be fine, but then we should also deprecate passing directories. This needs to be discussed further.
Low priority, but let's keep this open for now.
Yeah, adding directories has just been added in the last release, and honestly I'm uncertain about that either. There's already issues with symlink handling IIRC.
Btw, vanilla nixfmt behaves the same
(discussed in the team meeting today)
nix fmt
this becomes less importanttreefmt
nixfmt
treefmt
or nix
take care of this instead.nixfmt
should not be in charge of recursing into directories. That functionality should be removed before the first official release.So let's not worry about implementing this and instead focus on nix fmt
/treefmt
integration. We can keep the open issue for now though
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/formatting-team-meeting-2024-03-19/41845/1
Context
Currently testing out the new
pkgs.nixfmt-rfc-style
, and it's taking forever + erroring out since it attempts to format my .gitignored.direnv/
folder:Expected behaviour
Things to consider:
.direnv/
,result/
)?