aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/fmt.sh
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2024-09-05 10:29:48 +0200
committerJade Lovelace <lix@jade.fyi>2024-09-26 14:32:29 -0700
commit2265536e853437dc1f36f9c7a20eb2ebeac6ecaa (patch)
treece62a8c5255a20dcd0de5cbb33e39205ba14746e /tests/functional/fmt.sh
parentcc183fdbc14ce105a5661d646983f791978b9d5c (diff)
fix(nix fmt): remove the default "." argument
When `nix fmt` is called without an argument, Nix appends the "." argument before calling the formatter. The comment in the code is: > Format the current flake out of the box This also happens when formatting sub-folders. This means that the formatter is now unable to distinguish, as an interface, whether the "." argument is coming from the flake or the user's intent to format the current folder. This decision should be up to the formatter. Treefmt, for example, will automatically look up the project's root and format all the files. This is the desired behaviour. But because the "." argument is passed, it cannot function as expected. Upstream-PR: https://github.com/nixos/nix/pull/11438 Change-Id: I60fb6b3ed4ec1b24f81b5f0d76c0be98470817ce
Diffstat (limited to 'tests/functional/fmt.sh')
-rw-r--r--tests/functional/fmt.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/functional/fmt.sh b/tests/functional/fmt.sh
index 3c1bd9989..7d6add9b6 100644
--- a/tests/functional/fmt.sh
+++ b/tests/functional/fmt.sh
@@ -26,7 +26,10 @@ cat << EOF > flake.nix
};
}
EOF
-nix fmt ./file ./folder | grep 'Formatting: ./file ./folder'
+# No arguments check
+[[ "$(nix fmt)" = "Formatting(0):" ]]
+# Argument forwarding check
+nix fmt ./file ./folder | grep 'Formatting(2): ./file ./folder'
nix flake check
nix flake show | grep -P "package 'formatter'"