diff --git a/src/Nixfmt/Pretty.hs b/src/Nixfmt/Pretty.hs index db67f5ff..e0114bab 100644 --- a/src/Nixfmt/Pretty.hs +++ b/src/Nixfmt/Pretty.hs @@ -110,8 +110,8 @@ instance (Pretty a) => Pretty (Item a) where pretty (Item x) = group x -- For lists, attribute sets and let bindings -prettyItems :: (Pretty a) => Items a -> Doc -prettyItems (Items items) = go items +prettyItemsWith :: (Pretty a) => Doc -> Items a -> Doc +prettyItemsWith separator (Items items) = go items where go [] = mempty go [item] = pretty item @@ -120,9 +120,9 @@ prettyItems (Items items) = go items pretty (LanguageAnnotation lang) <> hardspace <> group stringItem - <> if null rest then mempty else hardline <> go rest + <> if null rest then mempty else separator <> go rest go (item : rest) = - pretty item <> if null rest then mempty else hardline <> go rest + pretty item <> if null rest then mempty else separator <> go rest instance Pretty Trivia where pretty [] = mempty @@ -197,7 +197,7 @@ prettySet _ (krec, paropen@(LoneAnn _), Items [], parclose@Ann{preTrivia = []}) -- Singleton sets are allowed to fit onto one line, -- but apart from that always expand. prettySet wide (krec, paropen@Ann{trailComment = post}, binders, parclose) = - let !surrounded = surroundWith sep (nest $ pretty post <> prettyItems binders) + let !surrounded = surroundWith sep (nest $ pretty post <> prettyItemsWith hardline binders) in pretty (fmap (,hardspace) krec) <> pretty (paropen{trailComment = Nothing}) <> surrounded @@ -242,14 +242,16 @@ prettyTerm (List paropen@Ann{trailComment = Nothing} (Items []) parclose@Ann{pre -- If the brackets are on different lines, keep them like that sep = if sourceLine paropen /= sourceLine parclose then hardline else hardspace -- General list --- Always expand if len > 1 prettyTerm (List paropen@Ann{trailComment = post} items parclose) = pretty (paropen{trailComment = Nothing}) - <> surroundWith sur (nest $ pretty post <> prettyItems items) + <> surroundWith sur (nest $ pretty post <> prettyItemsWith sur items) <> pretty parclose where - -- If the brackets are on different lines, keep them like that - sur = if sourceLine paropen /= sourceLine parclose then hardline else line + sur + | sourceLine paropen /= sourceLine parclose = hardline -- If the brackets are on different lines, keep them like that + | length (unItems items) > 6 = hardline -- More than 6 items: always expand + | length (unItems items) > 1 && not (all (isSimple . Term) items) = hardline -- More than 1 item containing non-simple items: expand + | otherwise = line -- Otherwise, try to fit onto one line prettyTerm (Set krec paropen items parclose) = prettySet False (krec, paropen, items, parclose) -- Parentheses prettyTerm (Parenthesized paropen expr parclose@Ann{preTrivia = closePre}) = @@ -412,36 +414,19 @@ prettyApp indentFunction pre hasPost f a = -- This is very hacky, but selections shouldn't be in a priority group, -- because if they get expanded before anything else, -- only the `.`-and-after part gets to a new line, which looks very odd - absorbApp (Application f' a'@(Term Selection{})) = group' Transparent (absorbApp f') <> line <> nest (group' RegularG $ absorbInner a') + absorbApp (Application f' a'@(Term Selection{})) = group' Transparent (absorbApp f') <> line <> nest (group' RegularG $ pretty a') -- If two consecutive arguments are lists, treat them specially: Don't priority expand, and also -- if one does not fit onto the line then put both on a new line each. -- Note that this does not handle the case where the two last arguments are lists, as the last argument -- is handled elsewhere and cannot be pattern-matched here. absorbApp (Application (Application f' l1@(Term List{})) l2@(Term List{})) = - group' Transparent (group' Transparent (absorbApp f') <> nest (group' RegularG $ line <> group (absorbInner l1) <> line <> group (absorbInner l2))) - absorbApp (Application f' a') = group' Transparent (absorbApp f') <> line <> nest (group' Priority $ absorbInner a') + group' Transparent (group' Transparent (absorbApp f') <> nest (group' RegularG $ line <> group (pretty l1) <> line <> group (pretty l2))) + absorbApp (Application f' a') = group' Transparent (absorbApp f') <> line <> nest (group' Priority $ pretty a') -- First argument absorbApp expr | indentFunction && null comment' = nest $ group' RegularG $ line' <> pretty expr | otherwise = pretty expr - -- Render the inner arguments of a function call - absorbInner :: Expression -> Doc - -- If lists have only simple items, try to render them single-line instead of expanding - -- This is just a copy of the list rendering code, but with `sepBy line` instead of `sepBy hardline` - absorbInner (Term (List paropen@Ann{trailComment = post'} items parclose)) - | length (unItems items) <= 6 && all (isSimple . Term) items = - pretty (paropen{trailComment = Nothing}) - <> surroundWith sur (nest $ pretty post' <> sepBy line (unItems items)) - <> pretty parclose - where - -- If the brackets are on different lines, keep them like that - sur - | sourceLine paropen /= sourceLine parclose = hardline - | null $ unItems items = hardspace - | otherwise = line - absorbInner expr = pretty expr - -- Render the last argument of a function call absorbLast :: Expression -> Doc absorbLast (Term t) @@ -512,9 +497,9 @@ prettyApp indentFunction pre hasPost f a = group' RegularG $ (pre <> group' Transparent (absorbApp fWithoutCommandAndWithoutArg)) <> line - <> nest (group (absorbInner l1)) + <> nest (group (pretty l1)) <> line - <> nest (group (absorbInner l2)) + <> nest (group (pretty l2)) <> post _ -> renderSimple @@ -696,7 +681,7 @@ instance Pretty Expression where convertTrailing (Just (TrailingComment t)) = [LineComment (" " <> t)] letPart = group $ pretty let_ <> hardline <> letBody - letBody = nest $ prettyItems binders + letBody = nest $ prettyItemsWith hardline binders inPart = group $ pretty in_ diff --git a/test/correct-indent-4.nix b/test/correct-indent-4.nix index 5cfbe753..b3d7d6e7 100644 --- a/test/correct-indent-4.nix +++ b/test/correct-indent-4.nix @@ -466,12 +466,7 @@ rec { }: assert isInt depthLimit; let - specialAttrs = [ - "__functor" - "__functionArgs" - "__toString" - "__pretty" - ]; + specialAttrs = [ "__functor" "__functionArgs" "__toString" "__pretty" ]; stepIntoAttr = evalNext: name: if elem name specialAttrs then id else evalNext; transform = depth: @@ -543,11 +538,7 @@ rec { else if isString v then let lines = filter (v: !isList v) (split "\n" v); - escapeSingleline = escape [ - "\\" - "\"" - "\${" - ]; + escapeSingleline = escape [ "\\" "\"" "\${" ]; escapeMultiline = replaceStrings [ "\${" "''" ] [ "''\${" "'''" ]; singlelineResult = "\"" + concatStringsSep "\\n" (map escapeSingleline lines) + "\""; diff --git a/test/diff/apply/out-pure.nix b/test/diff/apply/out-pure.nix index 9db9ebca..e0ccd01a 100644 --- a/test/diff/apply/out-pure.nix +++ b/test/diff/apply/out-pure.nix @@ -155,11 +155,7 @@ utils.lib.eachDefaultSystem (system: { }); } { - escapeSingleline = libStr.escape [ - "\\" - ''"'' - "\${" - ]; + escapeSingleline = libStr.escape [ "\\" ''"'' "\${" ]; escapeMultiline = libStr.replaceStrings [ "\${" "''" ] [ "''\${" "'''" ]; test = foo diff --git a/test/diff/apply_with_lists/out-pure.nix b/test/diff/apply_with_lists/out-pure.nix index 51dedb75..a7e87b80 100644 --- a/test/diff/apply_with_lists/out-pure.nix +++ b/test/diff/apply_with_lists/out-pure.nix @@ -2,10 +2,7 @@ [ (f [ ] [ rhs lhs ]) - (lib.mkMerge [ - false - false - ]) + (lib.mkMerge [ false false ]) (replaceStrings [ "\${" "''" ] #force multiline @@ -46,30 +43,12 @@ [ "services" "xserver" "displayManager" "sddm" "enable" ] [ "services" "displayManager" "sddm" "enable" ] ) - (map ( - buildAllowCommand "allow" [ - "snapshot" - "mount" - "destroy" - ] - )) - (map - ( - x: - "${x} ${ - escapeShellArgs [ - stateDir - workDir - logsDir - ] - }" - ) - [ - "+${unconfigureRunner}" # runs as root - configureRunner - setupWorkDir - ] - ) + (map (buildAllowCommand "allow" [ "snapshot" "mount" "destroy" ])) + (map (x: "${x} ${escapeShellArgs [ stateDir workDir logsDir ]}") [ + "+${unconfigureRunner}" # runs as root + configureRunner + setupWorkDir + ]) (lib.checkListOfEnum "${pname}: theme accent" [ "Blue" "Flamingo" "Green" ] [ accent ] @@ -82,17 +61,11 @@ [ coq.coq-version ssreflect.version ] [ { - cases = [ - (lib.versions.range "8.15" "8.20") - lib.pred.true - ]; + cases = [ (lib.versions.range "8.15" "8.20") lib.pred.true ]; out = "2.0.4"; } { - cases = [ - "8.5" - lib.pred.true - ]; + cases = [ "8.5" lib.pred.true ]; out = "20170512"; } ] diff --git a/test/diff/apply_with_lists/out.nix b/test/diff/apply_with_lists/out.nix index 9ed360b6..9afa1ac1 100644 --- a/test/diff/apply_with_lists/out.nix +++ b/test/diff/apply_with_lists/out.nix @@ -2,10 +2,7 @@ [ (f [ ] [ rhs lhs ]) - (lib.mkMerge [ - false - false - ]) + (lib.mkMerge [ false false ]) (replaceStrings [ "\${" "''" ] #force multiline @@ -52,30 +49,12 @@ ] [ "services" "displayManager" "sddm" "enable" ] ) - (map ( - buildAllowCommand "allow" [ - "snapshot" - "mount" - "destroy" - ] - )) - (map - ( - x: - "${x} ${ - escapeShellArgs [ - stateDir - workDir - logsDir - ] - }" - ) - [ - "+${unconfigureRunner}" # runs as root - configureRunner - setupWorkDir - ] - ) + (map (buildAllowCommand "allow" [ "snapshot" "mount" "destroy" ])) + (map (x: "${x} ${escapeShellArgs [ stateDir workDir logsDir ]}") [ + "+${unconfigureRunner}" # runs as root + configureRunner + setupWorkDir + ]) (lib.checkListOfEnum "${pname}: theme accent" [ "Blue" diff --git a/test/diff/attr_set/out-pure.nix b/test/diff/attr_set/out-pure.nix index c3b94587..9301750c 100644 --- a/test/diff/attr_set/out-pure.nix +++ b/test/diff/attr_set/out-pure.nix @@ -142,16 +142,8 @@ ] ++ (if foo then [ bar ] else [ baz ]) ++ [ ] - ++ (optionals condition [ - more - items - ]); - b = with pkgs; [ - a - lot - of - packages - ]; + ++ (optionals condition [ more items ]); + b = with pkgs; [ a lot of packages ]; } { systemd.initrdBi = lib.mkIf config.boot.initrd.services.lvm.enable [ pkgs.vdo ]; @@ -306,31 +298,14 @@ # Parentheses { a = ({ }); - b = ([ - 1 - 2 - 3 - ]); + b = ([ 1 2 3 ]); c = (if null then true else false); d = ( let in - [ - 1 - 2 - 3 - ] - ); - e = ( - if null then - true - else - [ - 1 - 2 - 3 - ] + [ 1 2 3 ] ); + e = (if null then true else [ 1 2 3 ]); # FIXME: This one exposes a really weird bug in the underlying # pretty printing engine. # (It's probably the same one that causes weird indentation in @@ -338,24 +313,13 @@ # f = /* comment */ (if null then true else [ 1 2 3 ]); a = (with a; { }); - b = ( - with a; - [ - 1 - 2 - 3 - ] - ); + b = (with a; [ 1 2 3 ]); c = (with a; if null then true else false); d = ( with a; let in - [ - 1 - 2 - 3 - ] + [ 1 2 3 ] ); } @@ -370,10 +334,7 @@ # Sans) than that horror. But we do need the Adobe fonts for some # old non-fontconfig applications. (Possibly this could be done # better using a fontconfig rule.) - [ - pkgs.xorg.fontadobe100dpi - pkgs.xorg.fontadobe75dpi - ]; + [ pkgs.xorg.fontadobe100dpi pkgs.xorg.fontadobe75dpi ]; } # Regression https://github.com/NixOS/nixfmt/issues/253 { @@ -395,10 +356,7 @@ boot.kernelParams = [ aaaaaaaaaaaaaa ] - ++ optionals config.boot.vesa [ - "vga=0x317" - "nomodeset" - ]; + ++ optionals config.boot.vesa [ "vga=0x317" "nomodeset" ]; foo2 = [ bar @@ -409,20 +367,11 @@ foo3 = some function application that kinda is long # and multiline - ++ [ - a - list - ]; + ++ [ a list ]; some.long.attribute # with a comment = [ stuff ] ++ more stuff; some.long.attribute1 # with a comment - = [ - stuff - a - b - c - ] - ++ more stuff; + = [ stuff a b c ] ++ more stuff; foo4 # nasty = # comments @@ -442,28 +391,12 @@ ++ lib.optional config.users.ldap.enable pam_ldap ++ lib.optional config.services.kanidm.enablePam config.services.kanidm.package ++ lib.optional config.services.sssd.enable pkgs.sssd - ++ lib.optionals config.security.pam.krb5.enable [ - pam_krb5 - pam_ccreds - ]; + ++ lib.optionals config.security.pam.krb5.enable [ pam_krb5 pam_ccreds ]; - buildInputs1 = lib.optionals onePlatform [ - a - b - c - ]; + buildInputs1 = lib.optionals onePlatform [ a b c ]; buildInputs2 = - lib.optionals onePlatform [ - a - b - c - ] - ++ lib.optionals anotherPlatform [ - d - e - f - ]; + lib.optionals onePlatform [ a b c ] ++ lib.optionals anotherPlatform [ d e f ]; programs.ssh.knownHosts = someStuff functionArg diff --git a/test/diff/attr_set/out.nix b/test/diff/attr_set/out.nix index dc9b1ef2..7052a3aa 100644 --- a/test/diff/attr_set/out.nix +++ b/test/diff/attr_set/out.nix @@ -145,10 +145,7 @@ ] ++ (if foo then [ bar ] else [ baz ]) ++ [ ] - ++ (optionals condition [ - more - items - ]); + ++ (optionals condition [ more items ]); b = with pkgs; [ a lot @@ -309,31 +306,14 @@ # Parentheses { a = ({ }); - b = ([ - 1 - 2 - 3 - ]); + b = ([ 1 2 3 ]); c = (if null then true else false); d = ( let in - [ - 1 - 2 - 3 - ] - ); - e = ( - if null then - true - else - [ - 1 - 2 - 3 - ] + [ 1 2 3 ] ); + e = (if null then true else [ 1 2 3 ]); # FIXME: This one exposes a really weird bug in the underlying # pretty printing engine. # (It's probably the same one that causes weird indentation in @@ -341,24 +321,13 @@ # f = /* comment */ (if null then true else [ 1 2 3 ]); a = (with a; { }); - b = ( - with a; - [ - 1 - 2 - 3 - ] - ); + b = (with a; [ 1 2 3 ]); c = (with a; if null then true else false); d = ( with a; let in - [ - 1 - 2 - 3 - ] + [ 1 2 3 ] ); } @@ -433,13 +402,7 @@ some.long.attribute # with a comment = [ stuff ] ++ more stuff; some.long.attribute1 # with a comment - = [ - stuff - a - b - c - ] - ++ more stuff; + = [ stuff a b c ] ++ more stuff; foo4 # nasty = # comments diff --git a/test/diff/idioms_lib_2/out-pure.nix b/test/diff/idioms_lib_2/out-pure.nix index 1fc274f0..8cbc7ab2 100644 --- a/test/diff/idioms_lib_2/out-pure.nix +++ b/test/diff/idioms_lib_2/out-pure.nix @@ -351,13 +351,7 @@ rec { Type: string -> a -> a */ warn = - if - lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") [ - "1" - "true" - "yes" - ] - then + if lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") [ "1" "true" "yes" ] then msg: builtins.trace "warning: ${msg}" ( abort "NIX_ABORT_ON_WARN=true; warnings are treated as unrecoverable errors." diff --git a/test/diff/idioms_lib_2/out.nix b/test/diff/idioms_lib_2/out.nix index 1fc274f0..8cbc7ab2 100644 --- a/test/diff/idioms_lib_2/out.nix +++ b/test/diff/idioms_lib_2/out.nix @@ -351,13 +351,7 @@ rec { Type: string -> a -> a */ warn = - if - lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") [ - "1" - "true" - "yes" - ] - then + if lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") [ "1" "true" "yes" ] then msg: builtins.trace "warning: ${msg}" ( abort "NIX_ABORT_ON_WARN=true; warnings are treated as unrecoverable errors." diff --git a/test/diff/idioms_lib_3/out-pure.nix b/test/diff/idioms_lib_3/out-pure.nix index d704f9a5..929d0cde 100644 --- a/test/diff/idioms_lib_3/out-pure.nix +++ b/test/diff/idioms_lib_3/out-pure.nix @@ -280,12 +280,7 @@ rec { }: assert builtins.isInt depthLimit; let - specialAttrs = [ - "__functor" - "__functionArgs" - "__toString" - "__pretty" - ]; + specialAttrs = [ "__functor" "__functionArgs" "__toString" "__pretty" ]; stepIntoAttr = evalNext: name: if builtins.elem name specialAttrs then id else evalNext; transform = @@ -361,11 +356,7 @@ rec { else if isString v then let lines = filter (v: !isList v) (builtins.split "\n" v); - escapeSingleline = libStr.escape [ - "\\" - ''"'' - "\${" - ]; + escapeSingleline = libStr.escape [ "\\" ''"'' "\${" ]; escapeMultiline = libStr.replaceStrings [ "\${" "''" ] [ "''\${" "'''" ]; singlelineResult = ''"'' + concatStringsSep "\\n" (map escapeSingleline lines) + ''"''; diff --git a/test/diff/idioms_lib_3/out.nix b/test/diff/idioms_lib_3/out.nix index 2686bade..8d148498 100644 --- a/test/diff/idioms_lib_3/out.nix +++ b/test/diff/idioms_lib_3/out.nix @@ -293,12 +293,7 @@ rec { }: assert builtins.isInt depthLimit; let - specialAttrs = [ - "__functor" - "__functionArgs" - "__toString" - "__pretty" - ]; + specialAttrs = [ "__functor" "__functionArgs" "__toString" "__pretty" ]; stepIntoAttr = evalNext: name: if builtins.elem name specialAttrs then id else evalNext; transform = @@ -374,11 +369,7 @@ rec { else if isString v then let lines = filter (v: !isList v) (builtins.split "\n" v); - escapeSingleline = libStr.escape [ - "\\" - ''"'' - "\${" - ]; + escapeSingleline = libStr.escape [ "\\" ''"'' "\${" ]; escapeMultiline = libStr.replaceStrings [ "\${" "''" ] [ "''\${" "'''" ]; singlelineResult = ''"'' + concatStringsSep "\\n" (map escapeSingleline lines) + ''"''; diff --git a/test/diff/idioms_lib_4/out-pure.nix b/test/diff/idioms_lib_4/out-pure.nix index c1ed4245..bada73f4 100644 --- a/test/diff/idioms_lib_4/out-pure.nix +++ b/test/diff/idioms_lib_4/out-pure.nix @@ -54,13 +54,7 @@ rec { ################################################################################ # Reasonable power of 2 - types.bitWidth = enum [ - 8 - 16 - 32 - 64 - 128 - ]; + types.bitWidth = enum [ 8 16 32 64 128 ]; ################################################################################ @@ -771,13 +765,7 @@ rec { "3" = # cpu-kernel-environment if - elemAt l 1 == "linux" - || elem (elemAt l 2) [ - "eabi" - "eabihf" - "elf" - "gnu" - ] + elemAt l 1 == "linux" || elem (elemAt l 2) [ "eabi" "eabihf" "elf" "gnu" ] then { cpu = elemAt l 0; @@ -788,13 +776,7 @@ rec { # cpu-vendor-os else if elemAt l 1 == "apple" - || elem (elemAt l 2) [ - "wasi" - "redox" - "mmixware" - "ghcjs" - "mingw32" - ] + || elem (elemAt l 2) [ "wasi" "redox" "mmixware" "ghcjs" "mingw32" ] || hasPrefix "freebsd" (elemAt l 2) || hasPrefix "netbsd" (elemAt l 2) || hasPrefix "genode" (elemAt l 2) diff --git a/test/diff/idioms_lib_4/out.nix b/test/diff/idioms_lib_4/out.nix index c1ed4245..bada73f4 100644 --- a/test/diff/idioms_lib_4/out.nix +++ b/test/diff/idioms_lib_4/out.nix @@ -54,13 +54,7 @@ rec { ################################################################################ # Reasonable power of 2 - types.bitWidth = enum [ - 8 - 16 - 32 - 64 - 128 - ]; + types.bitWidth = enum [ 8 16 32 64 128 ]; ################################################################################ @@ -771,13 +765,7 @@ rec { "3" = # cpu-kernel-environment if - elemAt l 1 == "linux" - || elem (elemAt l 2) [ - "eabi" - "eabihf" - "elf" - "gnu" - ] + elemAt l 1 == "linux" || elem (elemAt l 2) [ "eabi" "eabihf" "elf" "gnu" ] then { cpu = elemAt l 0; @@ -788,13 +776,7 @@ rec { # cpu-vendor-os else if elemAt l 1 == "apple" - || elem (elemAt l 2) [ - "wasi" - "redox" - "mmixware" - "ghcjs" - "mingw32" - ] + || elem (elemAt l 2) [ "wasi" "redox" "mmixware" "ghcjs" "mingw32" ] || hasPrefix "freebsd" (elemAt l 2) || hasPrefix "netbsd" (elemAt l 2) || hasPrefix "genode" (elemAt l 2) diff --git a/test/diff/idioms_lib_5/out-pure.nix b/test/diff/idioms_lib_5/out-pure.nix index ee898df8..83733566 100644 --- a/test/diff/idioms_lib_5/out-pure.nix +++ b/test/diff/idioms_lib_5/out-pure.nix @@ -549,15 +549,7 @@ let let hasOutput = out: builtins.elem out outputs; in - [ - (lib.findFirst hasOutput null ( - [ - "bin" - "out" - ] - ++ outputs - )) - ] + [ (lib.findFirst hasOutput null ([ "bin" "out" ] ++ outputs)) ] ++ lib.optional (hasOutput "man") "man"; } // attrs.meta or { } diff --git a/test/diff/idioms_lib_5/out.nix b/test/diff/idioms_lib_5/out.nix index ee898df8..83733566 100644 --- a/test/diff/idioms_lib_5/out.nix +++ b/test/diff/idioms_lib_5/out.nix @@ -549,15 +549,7 @@ let let hasOutput = out: builtins.elem out outputs; in - [ - (lib.findFirst hasOutput null ( - [ - "bin" - "out" - ] - ++ outputs - )) - ] + [ (lib.findFirst hasOutput null ([ "bin" "out" ] ++ outputs)) ] ++ lib.optional (hasOutput "man") "man"; } // attrs.meta or { } diff --git a/test/diff/idioms_nixos_1/out-pure.nix b/test/diff/idioms_nixos_1/out-pure.nix index f91f862d..b18a6c30 100644 --- a/test/diff/idioms_nixos_1/out-pure.nix +++ b/test/diff/idioms_nixos_1/out-pure.nix @@ -148,10 +148,7 @@ in boot.initrd.availableKernelModules = mkOption { type = types.listOf types.str; default = [ ]; - example = [ - "sata_nv" - "ext3" - ]; + example = [ "sata_nv" "ext3" ]; description = '' The set of kernel modules in the initial ramdisk used during the boot process. This set must include all modules necessary for @@ -293,17 +290,11 @@ in boot.kernelParams = [ "loglevel=${toString config.boot.consoleLogLevel}" ] - ++ optionals config.boot.vesa [ - "vga=0x317" - "nomodeset" - ]; + ++ optionals config.boot.vesa [ "vga=0x317" "nomodeset" ]; boot.kernel.sysctl."kernel.printk" = mkDefault config.boot.consoleLogLevel; - boot.kernelModules = [ - "loop" - "atkbd" - ]; + boot.kernelModules = [ "loop" "atkbd" ]; # The Linux kernel >= 2.6.27 provides firmware. hardware.firmware = [ kernel ]; diff --git a/test/diff/idioms_nixos_1/out.nix b/test/diff/idioms_nixos_1/out.nix index f91f862d..b18a6c30 100644 --- a/test/diff/idioms_nixos_1/out.nix +++ b/test/diff/idioms_nixos_1/out.nix @@ -148,10 +148,7 @@ in boot.initrd.availableKernelModules = mkOption { type = types.listOf types.str; default = [ ]; - example = [ - "sata_nv" - "ext3" - ]; + example = [ "sata_nv" "ext3" ]; description = '' The set of kernel modules in the initial ramdisk used during the boot process. This set must include all modules necessary for @@ -293,17 +290,11 @@ in boot.kernelParams = [ "loglevel=${toString config.boot.consoleLogLevel}" ] - ++ optionals config.boot.vesa [ - "vga=0x317" - "nomodeset" - ]; + ++ optionals config.boot.vesa [ "vga=0x317" "nomodeset" ]; boot.kernel.sysctl."kernel.printk" = mkDefault config.boot.consoleLogLevel; - boot.kernelModules = [ - "loop" - "atkbd" - ]; + boot.kernelModules = [ "loop" "atkbd" ]; # The Linux kernel >= 2.6.27 provides firmware. hardware.firmware = [ kernel ]; diff --git a/test/diff/idioms_nixos_2/out-pure.nix b/test/diff/idioms_nixos_2/out-pure.nix index a9783291..19da220c 100644 --- a/test/diff/idioms_nixos_2/out-pure.nix +++ b/test/diff/idioms_nixos_2/out-pure.nix @@ -200,12 +200,7 @@ in description = lib.mdDoc "Log level value between 0 (DEBUG) and 4 (FATAL)."; }; logType = mkOption { - type = types.enum [ - "errorlog" - "file" - "syslog" - "systemd" - ]; + type = types.enum [ "errorlog" "file" "syslog" "systemd" ]; default = "syslog"; description = lib.mdDoc '' Logging backend to use. @@ -221,18 +216,11 @@ in package = mkOption { type = types.package; description = lib.mdDoc "Which package to use for the Nextcloud instance."; - relatedPackages = [ - "nextcloud24" - "nextcloud25" - "nextcloud26" - ]; + relatedPackages = [ "nextcloud24" "nextcloud25" "nextcloud26" ]; }; phpPackage = mkOption { type = types.package; - relatedPackages = [ - "php80" - "php81" - ]; + relatedPackages = [ "php80" "php81" ]; defaultText = "pkgs.php"; description = lib.mdDoc '' PHP package to use for Nextcloud. @@ -304,13 +292,7 @@ in }; poolSettings = mkOption { - type = - with types; - attrsOf (oneOf [ - str - int - bool - ]); + type = with types; attrsOf (oneOf [ str int bool ]); default = { "pm" = "dynamic"; "pm.max_children" = "32"; @@ -358,11 +340,7 @@ in config = { dbtype = mkOption { - type = types.enum [ - "sqlite" - "pgsql" - "mysql" - ]; + type = types.enum [ "sqlite" "pgsql" "mysql" ]; default = "sqlite"; description = lib.mdDoc "Database type."; }; @@ -436,12 +414,7 @@ in }; overwriteProtocol = mkOption { - type = types.nullOr ( - types.enum [ - "http" - "https" - ] - ); + type = types.nullOr (types.enum [ "http" "https" ]); default = null; example = "https"; @@ -1088,10 +1061,7 @@ in group = "nextcloud"; isSystemUser = true; }; - users.groups.nextcloud.members = [ - "nextcloud" - config.services.nginx.user - ]; + users.groups.nextcloud.members = [ "nextcloud" config.services.nginx.user ]; environment.systemPackages = [ occ ]; diff --git a/test/diff/idioms_nixos_2/out.nix b/test/diff/idioms_nixos_2/out.nix index 0534189c..734771f2 100644 --- a/test/diff/idioms_nixos_2/out.nix +++ b/test/diff/idioms_nixos_2/out.nix @@ -202,12 +202,7 @@ in description = lib.mdDoc "Log level value between 0 (DEBUG) and 4 (FATAL)."; }; logType = mkOption { - type = types.enum [ - "errorlog" - "file" - "syslog" - "systemd" - ]; + type = types.enum [ "errorlog" "file" "syslog" "systemd" ]; default = "syslog"; description = lib.mdDoc '' Logging backend to use. @@ -223,18 +218,11 @@ in package = mkOption { type = types.package; description = lib.mdDoc "Which package to use for the Nextcloud instance."; - relatedPackages = [ - "nextcloud24" - "nextcloud25" - "nextcloud26" - ]; + relatedPackages = [ "nextcloud24" "nextcloud25" "nextcloud26" ]; }; phpPackage = mkOption { type = types.package; - relatedPackages = [ - "php80" - "php81" - ]; + relatedPackages = [ "php80" "php81" ]; defaultText = "pkgs.php"; description = lib.mdDoc '' PHP package to use for Nextcloud. @@ -306,13 +294,7 @@ in }; poolSettings = mkOption { - type = - with types; - attrsOf (oneOf [ - str - int - bool - ]); + type = with types; attrsOf (oneOf [ str int bool ]); default = { "pm" = "dynamic"; "pm.max_children" = "32"; @@ -360,11 +342,7 @@ in config = { dbtype = mkOption { - type = types.enum [ - "sqlite" - "pgsql" - "mysql" - ]; + type = types.enum [ "sqlite" "pgsql" "mysql" ]; default = "sqlite"; description = lib.mdDoc "Database type."; }; @@ -438,12 +416,7 @@ in }; overwriteProtocol = mkOption { - type = types.nullOr ( - types.enum [ - "http" - "https" - ] - ); + type = types.nullOr (types.enum [ "http" "https" ]); default = null; example = "https"; @@ -1090,10 +1063,7 @@ in group = "nextcloud"; isSystemUser = true; }; - users.groups.nextcloud.members = [ - "nextcloud" - config.services.nginx.user - ]; + users.groups.nextcloud.members = [ "nextcloud" config.services.nginx.user ]; environment.systemPackages = [ occ ]; diff --git a/test/diff/idioms_pkgs_3/out-pure.nix b/test/diff/idioms_pkgs_3/out-pure.nix index 811361fa..7ad1fc5c 100644 --- a/test/diff/idioms_pkgs_3/out-pure.nix +++ b/test/diff/idioms_pkgs_3/out-pure.nix @@ -269,10 +269,7 @@ buildStdenv.mkDerivation ({ # Ignore trivial whitespace changes in patches, this fixes compatibility of # ./env_var_for_system_dir.patch with Firefox >=65 without having to track # two patches. - patchFlags = [ - "-p1" - "-l" - ]; + patchFlags = [ "-p1" "-l" ]; # if not explicitly set, wrong cc from buildStdenv would be used HOST_CC = "${llvmPackagesBuildBuild.stdenv.cc}/bin/cc"; @@ -295,10 +292,7 @@ buildStdenv.mkDerivation ({ which wrapGAppsHook ] - ++ lib.optionals crashreporterSupport [ - dump_syms - patchelf - ] + ++ lib.optionals crashreporterSupport [ dump_syms patchelf ] ++ lib.optionals pgoSupport [ xvfb-run ] ++ extraNativeBuildInputs; @@ -479,10 +473,7 @@ buildStdenv.mkDerivation ({ ++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed ++ lib.optional sndioSupport sndio ++ lib.optional gssSupport libkrb5 - ++ lib.optionals waylandSupport [ - libxkbcommon - libdrm - ] + ++ lib.optionals waylandSupport [ libxkbcommon libdrm ] ++ lib.optional jemallocSupport jemalloc ++ extraBuildInputs; diff --git a/test/diff/idioms_pkgs_3/out.nix b/test/diff/idioms_pkgs_3/out.nix index 0274e425..4f30a003 100644 --- a/test/diff/idioms_pkgs_3/out.nix +++ b/test/diff/idioms_pkgs_3/out.nix @@ -272,10 +272,7 @@ buildStdenv.mkDerivation ({ # Ignore trivial whitespace changes in patches, this fixes compatibility of # ./env_var_for_system_dir.patch with Firefox >=65 without having to track # two patches. - patchFlags = [ - "-p1" - "-l" - ]; + patchFlags = [ "-p1" "-l" ]; # if not explicitly set, wrong cc from buildStdenv would be used HOST_CC = "${llvmPackagesBuildBuild.stdenv.cc}/bin/cc"; @@ -298,10 +295,7 @@ buildStdenv.mkDerivation ({ which wrapGAppsHook ] - ++ lib.optionals crashreporterSupport [ - dump_syms - patchelf - ] + ++ lib.optionals crashreporterSupport [ dump_syms patchelf ] ++ lib.optionals pgoSupport [ xvfb-run ] ++ extraNativeBuildInputs; @@ -482,10 +476,7 @@ buildStdenv.mkDerivation ({ ++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed ++ lib.optional sndioSupport sndio ++ lib.optional gssSupport libkrb5 - ++ lib.optionals waylandSupport [ - libxkbcommon - libdrm - ] + ++ lib.optionals waylandSupport [ libxkbcommon libdrm ] ++ lib.optional jemallocSupport jemalloc ++ extraBuildInputs; diff --git a/test/diff/idioms_pkgs_4/out-pure.nix b/test/diff/idioms_pkgs_4/out-pure.nix index c6d7ea72..100e45a2 100644 --- a/test/diff/idioms_pkgs_4/out-pure.nix +++ b/test/diff/idioms_pkgs_4/out-pure.nix @@ -22,11 +22,7 @@ let (lib.optionals (system == "i686-solaris") [ "/usr/gnu" ]) ++ (lib.optionals (system == "i686-netbsd") [ "/usr/pkg" ]) ++ (lib.optionals (system == "x86_64-solaris") [ "/opt/local/gnu" ]) - ++ [ - "/" - "/usr" - "/usr/local" - ]; + ++ [ "/" "/usr" "/usr/local" ]; prehookBase = '' # Disable purity tests; it's allowed (even needed) to link to diff --git a/test/diff/idioms_pkgs_4/out.nix b/test/diff/idioms_pkgs_4/out.nix index 87861127..cf6c92dd 100644 --- a/test/diff/idioms_pkgs_4/out.nix +++ b/test/diff/idioms_pkgs_4/out.nix @@ -22,11 +22,7 @@ let (lib.optionals (system == "i686-solaris") [ "/usr/gnu" ]) ++ (lib.optionals (system == "i686-netbsd") [ "/usr/pkg" ]) ++ (lib.optionals (system == "x86_64-solaris") [ "/opt/local/gnu" ]) - ++ [ - "/" - "/usr" - "/usr/local" - ]; + ++ [ "/" "/usr" "/usr/local" ]; prehookBase = '' # Disable purity tests; it's allowed (even needed) to link to diff --git a/test/diff/idioms_pkgs_5/out-pure.nix b/test/diff/idioms_pkgs_5/out-pure.nix index 7a36b56c..05207c0b 100644 --- a/test/diff/idioms_pkgs_5/out-pure.nix +++ b/test/diff/idioms_pkgs_5/out-pure.nix @@ -164,16 +164,10 @@ let # Including it then would cause needless mass rebuilds. # # TODO(@Ericson2314): Make [ "build" "host" ] always the default / resolve #87909 - configurePlatforms ? - optionals - ( - stdenv.hostPlatform != stdenv.buildPlatform - || config.configurePlatformsByDefault - ) - [ - "build" - "host" - ], + configurePlatforms ? optionals ( + stdenv.hostPlatform != stdenv.buildPlatform + || config.configurePlatformsByDefault + ) [ "build" "host" ], # TODO(@Ericson2314): Make unconditional / resolve #33599 # Check phase @@ -648,10 +642,7 @@ let ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile - ++ [ - propagatedSandboxProfile - sandboxProfile - ]; + ++ [ propagatedSandboxProfile sandboxProfile ]; final = concatStringsSep "\n" (filter (x: x != "") (unique profiles)); in final; @@ -664,12 +655,7 @@ let ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ stdenv.__extraImpureHostDeps - ++ [ - "/dev/zero" - "/dev/random" - "/dev/urandom" - "/bin/sh" - ]; + ++ [ "/dev/zero" "/dev/random" "/dev/urandom" "/bin/sh" ]; __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps; } diff --git a/test/diff/idioms_pkgs_5/out.nix b/test/diff/idioms_pkgs_5/out.nix index 3565ae87..c3cc41ec 100644 --- a/test/diff/idioms_pkgs_5/out.nix +++ b/test/diff/idioms_pkgs_5/out.nix @@ -164,16 +164,10 @@ let # Including it then would cause needless mass rebuilds. # # TODO(@Ericson2314): Make [ "build" "host" ] always the default / resolve #87909 - configurePlatforms ? - optionals - ( - stdenv.hostPlatform != stdenv.buildPlatform - || config.configurePlatformsByDefault - ) - [ - "build" - "host" - ], + configurePlatforms ? optionals ( + stdenv.hostPlatform != stdenv.buildPlatform + || config.configurePlatformsByDefault + ) [ "build" "host" ], # TODO(@Ericson2314): Make unconditional / resolve #33599 # Check phase @@ -653,10 +647,7 @@ let ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile - ++ [ - propagatedSandboxProfile - sandboxProfile - ]; + ++ [ propagatedSandboxProfile sandboxProfile ]; final = concatStringsSep "\n" (filter (x: x != "") (unique profiles)); in final; diff --git a/test/diff/if_else/out-pure.nix b/test/diff/if_else/out-pure.nix index 479cd610..a938e968 100644 --- a/test/diff/if_else/out-pure.nix +++ b/test/diff/if_else/out-pure.nix @@ -41,13 +41,7 @@ ] then foo - else if - [ - more - multi - line - ] - then + else if [ more multi line ] then bar else baz diff --git a/test/diff/lambda/out-pure.nix b/test/diff/lambda/out-pure.nix index 5d888163..8c8b8370 100644 --- a/test/diff/lambda/out-pure.nix +++ b/test/diff/lambda/out-pure.nix @@ -106,73 +106,35 @@ in ( { - gst_plugins ? [ - gst-plugins-good - gst-plugins-ugly - ], + gst_plugins ? [ gst-plugins-good gst-plugins-ugly ], more ? let in - [ - 1 - 2 - 3 - ], + [ 1 2 3 ], things ? if null then true else false, things ? if null then true else "loooooooooooooooooooooooooooooooooooooooooooong", more ? ( let in - [ - 1 - 2 - 3 - ] - ), - foo ? ( - with bar; - [ - 1 - 2 - 3 - ] + [ 1 2 3 ] ), + foo ? (with bar; [ 1 2 3 ]), foo ? ( with bar; let in - [ - 1 - 2 - 3 - ] + [ 1 2 3 ] ), things ? (if null then true else false), things ? ( if null then true else "loooooooooooooooooooooooooooooooooooooooooooong" ), things ? ( - if null then - [ - 1 - 2 - 3 - ] - else - "loooooooooooooooooooooooooooooooooooooooooooong" + if null then [ 1 2 3 ] else "loooooooooooooooooooooooooooooooooooooooooooong" ), things ? # comment - ( - if null then - [ - 1 - 2 - 3 - ] - else - "loooooooooooooooooooooooooooooooooooooooooooong" - ), + (if null then [ 1 2 3 ] else "loooooooooooooooooooooooooooooooooooooooooooong"), }: { } ) @@ -184,15 +146,8 @@ in a' = name: '' --nodaemon --syslog --prefix=${name} --pidfile /run/${name}/${name}.pid ${name} ''; - b = - p: with p; [ - ConfigIniFiles - FileSlurp - ]; - b' = p: [ - ConfigIniFiles - FileSlurp - ]; + b = p: with p; [ ConfigIniFiles FileSlurp ]; + b' = p: [ ConfigIniFiles FileSlurp ]; mkUrls = { name, diff --git a/test/diff/lambda/out.nix b/test/diff/lambda/out.nix index 16eb44de..ce9694fd 100644 --- a/test/diff/lambda/out.nix +++ b/test/diff/lambda/out.nix @@ -124,66 +124,31 @@ in more ? let in - [ - 1 - 2 - 3 - ], + [ 1 2 3 ], things ? if null then true else false, things ? if null then true else "loooooooooooooooooooooooooooooooooooooooooooong", more ? ( let in - [ - 1 - 2 - 3 - ] - ), - foo ? ( - with bar; - [ - 1 - 2 - 3 - ] + [ 1 2 3 ] ), + foo ? (with bar; [ 1 2 3 ]), foo ? ( with bar; let in - [ - 1 - 2 - 3 - ] + [ 1 2 3 ] ), things ? (if null then true else false), things ? ( if null then true else "loooooooooooooooooooooooooooooooooooooooooooong" ), things ? ( - if null then - [ - 1 - 2 - 3 - ] - else - "loooooooooooooooooooooooooooooooooooooooooooong" + if null then [ 1 2 3 ] else "loooooooooooooooooooooooooooooooooooooooooooong" ), things ? # comment - ( - if null then - [ - 1 - 2 - 3 - ] - else - "loooooooooooooooooooooooooooooooooooooooooooong" - ), + (if null then [ 1 2 3 ] else "loooooooooooooooooooooooooooooooooooooooooooong"), }: { } ) diff --git a/test/diff/language-annotation/in.nix b/test/diff/language-annotation/in.nix index bc11af5d..8d0a2f40 100644 --- a/test/diff/language-annotation/in.nix +++ b/test/diff/language-annotation/in.nix @@ -70,6 +70,18 @@ "console.log('Script 4');" ]; + # Language annotation in list on function argument + runScripts = (lib.mkSomething [ + /* bash */ '' + echo "Script A" + '' + ][ + /* python */ '' + print("Script B") + '' + /* ruby */ "puts 'Script C'" + ]); + aboveString = /* bash */ "echo 'Above string'"; diff --git a/test/diff/language-annotation/out-pure.nix b/test/diff/language-annotation/out-pure.nix index d83aedb4..6c518e4a 100644 --- a/test/diff/language-annotation/out-pure.nix +++ b/test/diff/language-annotation/out-pure.nix @@ -74,6 +74,22 @@ /* js */ "console.log('Script 4');" ]; + # Language annotation in list on function argument + runScripts = ( + lib.mkSomething + [ + /* bash */ '' + echo "Script A" + '' + ] + [ + /* python */ '' + print("Script B") + '' + /* ruby */ "puts 'Script C'" + ] + ); + aboveString = /* bash */ "echo 'Above string'"; # Language annotation in attribute set diff --git a/test/diff/language-annotation/out.nix b/test/diff/language-annotation/out.nix index d83aedb4..6c518e4a 100644 --- a/test/diff/language-annotation/out.nix +++ b/test/diff/language-annotation/out.nix @@ -74,6 +74,22 @@ /* js */ "console.log('Script 4');" ]; + # Language annotation in list on function argument + runScripts = ( + lib.mkSomething + [ + /* bash */ '' + echo "Script A" + '' + ] + [ + /* python */ '' + print("Script B") + '' + /* ruby */ "puts 'Script C'" + ] + ); + aboveString = /* bash */ "echo 'Above string'"; # Language annotation in attribute set diff --git a/test/diff/let_in/out-pure.nix b/test/diff/let_in/out-pure.nix index c0774c93..ee40436d 100644 --- a/test/diff/let_in/out-pure.nix +++ b/test/diff/let_in/out-pure.nix @@ -56,10 +56,7 @@ let a = let in - [ - 1 - 2 - ]; + [ 1 2 ]; a = let diff --git a/test/diff/lists/in.nix b/test/diff/lists/in.nix index 77a07401..f3c97a2f 100644 --- a/test/diff/lists/in.nix +++ b/test/diff/lists/in.nix @@ -83,8 +83,27 @@ ] - [ [ multi line ] ] [ [ [ singleton ] ] ] [ [ [ { } ] ] ] - [ [ [ { } multiline ] ] ] + + [ "a" "b" "c" ] + [ "a" + "b" + "c"] + [ + "a" + + "b" + + "c" + ] + + [1 2 3 4 5 6] + [1 2 3 4 5 6 7] + + [ "a" /*x*/ "b" /*y*/ "c" ./d {e = f;}] + [ "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" ] + ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "b" "c"] + + [ small /* inline comment */ should-break ] ] diff --git a/test/diff/lists/out-pure.nix b/test/diff/lists/out-pure.nix index 6bf6b5ae..d81d3124 100644 --- a/test/diff/lists/out-pure.nix +++ b/test/diff/lists/out-pure.nix @@ -50,10 +50,7 @@ [ 1 ] - [ - b - d - ] + [ b d ] [ b d # e @@ -108,20 +105,73 @@ ] - [ - [ - multi - line - ] - ] [ [ [ singleton ] ] ] [ [ [ { } ] ] ] + + [ "a" "b" "c" ] + [ "a" "b" "c" ] [ - [ - [ - { } - multiline - ] - ] + "a" + + "b" + + "c" + ] + + [ 1 2 3 4 5 6 ] + [ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + ] + + [ + "a" + /* x */ "b" + /* y */ "c" + ./d + { e = f; } + ] + [ + "a" + "b" + "c" + "d" + "e" + "f" + "g" + "h" + "i" + "j" + "k" + "l" + "m" + "n" + "o" + "p" + "q" + "r" + "s" + "t" + "u" + "v" + "w" + "x" + "y" + "z" + ] + [ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "b" + "c" + ] + + [ + small # inline comment + should-break ] ] diff --git a/test/diff/lists/out.nix b/test/diff/lists/out.nix index 6798279b..250f6767 100644 --- a/test/diff/lists/out.nix +++ b/test/diff/lists/out.nix @@ -53,10 +53,7 @@ 1 ] - [ - b - d - ] + [ b d ] [ b d # e @@ -111,20 +108,77 @@ ] - [ - [ - multi - line - ] - ] [ [ [ singleton ] ] ] [ [ [ { } ] ] ] + + [ "a" "b" "c" ] [ - [ - [ - { } - multiline - ] - ] + "a" + "b" + "c" + ] + [ + "a" + + "b" + + "c" + ] + + [ 1 2 3 4 5 6 ] + [ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + ] + + [ + "a" + /* x */ "b" + /* y */ "c" + ./d + { e = f; } + ] + [ + "a" + "b" + "c" + "d" + "e" + "f" + "g" + "h" + "i" + "j" + "k" + "l" + "m" + "n" + "o" + "p" + "q" + "r" + "s" + "t" + "u" + "v" + "w" + "x" + "y" + "z" + ] + [ + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "b" + "c" + ] + + [ + small # inline comment + should-break ] ] diff --git a/test/diff/monsters_3/out-pure.nix b/test/diff/monsters_3/out-pure.nix index 063dc219..fd242fbf 100644 --- a/test/diff/monsters_3/out-pure.nix +++ b/test/diff/monsters_3/out-pure.nix @@ -45,13 +45,7 @@ stdenv.mkDerivation rec { wrapGAppsHook4 glib # for glib-compile-resources ]; - buildInputs = [ - cairo - glib - gtk4 - libadwaita - pango - ]; + buildInputs = [ cairo glib gtk4 libadwaita pango ]; postPatch = '' patchShebangs build-aux/meson_post_install.py # https://gitlab.gnome.org/World/design/contrast/-/merge_requests/23 diff --git a/test/diff/monsters_3/out.nix b/test/diff/monsters_3/out.nix index 063dc219..fd242fbf 100644 --- a/test/diff/monsters_3/out.nix +++ b/test/diff/monsters_3/out.nix @@ -45,13 +45,7 @@ stdenv.mkDerivation rec { wrapGAppsHook4 glib # for glib-compile-resources ]; - buildInputs = [ - cairo - glib - gtk4 - libadwaita - pango - ]; + buildInputs = [ cairo glib gtk4 libadwaita pango ]; postPatch = '' patchShebangs build-aux/meson_post_install.py # https://gitlab.gnome.org/World/design/contrast/-/merge_requests/23 diff --git a/test/diff/operation/out-pure.nix b/test/diff/operation/out-pure.nix index f032b244..ff45bbe2 100644 --- a/test/diff/operation/out-pure.nix +++ b/test/diff/operation/out-pure.nix @@ -45,10 +45,7 @@ # comment on function application || foo bar baz # comment on function application 2 - || foo bar baz [ - 1 - 2 - ] + || foo bar baz [ 1 2 ] # comment on other || foo ? bar ) @@ -92,69 +89,16 @@ execFormats.elf ) ( - [ - aaaaaaaaaaaaa - aaaaaaaaaaaaa - ] - + - [ - bbbbbbbbbbbbbb - bbbbbbbbbbbbbbb - ] - * [ - ccccccccccccccc - ccccccccccccccccccc - ] + [ aaaaaaaaaaaaa aaaaaaaaaaaaa ] + + [ bbbbbbbbbbbbbb bbbbbbbbbbbbbbb ] * [ ccccccccccccccc ccccccccccccccccccc ] ) ( - [ - aaaaaaaaaaaaa - aaaaaaaaaaaaa - ] - * [ - bbbbbbbbbbbbbb - bbbbbbbbbbbbbbb - ] - + [ - ccccccccccccccc - ccccccccccccccccccc - ] + [ aaaaaaaaaaaaa aaaaaaaaaaaaa ] * [ bbbbbbbbbbbbbb bbbbbbbbbbbbbbb ] + + [ ccccccccccccccc ccccccccccccccccccc ] ) - ( - [ - 1 - 2 - 3 - ] - / [ - 4 - 5 - 6 - ] - / [ - 7 - 8 - 9 - ] - ) - ( - [ - 1 - 2 - 3 - ] - ++ [ - 4 - 5 - 6 - ] - ++ [ - 7 - 8 - 9 - ] - ) + ([ 1 2 3 ] / [ 4 5 6 ] / [ 7 8 9 ]) + ([ 1 2 3 ] ++ [ 4 5 6 ] ++ [ 7 8 9 ]) ( [ @@ -168,10 +112,7 @@ ] ++ (if foo then [ bar ] else [ baz ]) ++ [ ] - ++ (optionals condition [ - more - items - ]) + ++ (optionals condition [ more items ]) ) # Test precedence @@ -234,25 +175,7 @@ ) # Indentation with parenthesized multiline function call - ( - [ - 1 - 2 - 3 - ] - ++ (isOneOf item [ - 1 - 2 - 3 - 4 - ]) - ++ isOneOf item [ - 1 - 2 - 3 - 4 - ] - ) + ([ 1 2 3 ] ++ (isOneOf item [ 1 2 3 4 ]) ++ isOneOf item [ 1 2 3 4 ]) # Interaction with function calls ( g { diff --git a/test/diff/operation/out.nix b/test/diff/operation/out.nix index 3e1759f4..1c93ec56 100644 --- a/test/diff/operation/out.nix +++ b/test/diff/operation/out.nix @@ -92,69 +92,16 @@ execFormats.elf ) ( - [ - aaaaaaaaaaaaa - aaaaaaaaaaaaa - ] - + - [ - bbbbbbbbbbbbbb - bbbbbbbbbbbbbbb - ] - * [ - ccccccccccccccc - ccccccccccccccccccc - ] + [ aaaaaaaaaaaaa aaaaaaaaaaaaa ] + + [ bbbbbbbbbbbbbb bbbbbbbbbbbbbbb ] * [ ccccccccccccccc ccccccccccccccccccc ] ) ( - [ - aaaaaaaaaaaaa - aaaaaaaaaaaaa - ] - * [ - bbbbbbbbbbbbbb - bbbbbbbbbbbbbbb - ] - + [ - ccccccccccccccc - ccccccccccccccccccc - ] + [ aaaaaaaaaaaaa aaaaaaaaaaaaa ] * [ bbbbbbbbbbbbbb bbbbbbbbbbbbbbb ] + + [ ccccccccccccccc ccccccccccccccccccc ] ) - ( - [ - 1 - 2 - 3 - ] - / [ - 4 - 5 - 6 - ] - / [ - 7 - 8 - 9 - ] - ) - ( - [ - 1 - 2 - 3 - ] - ++ [ - 4 - 5 - 6 - ] - ++ [ - 7 - 8 - 9 - ] - ) + ([ 1 2 3 ] / [ 4 5 6 ] / [ 7 8 9 ]) + ([ 1 2 3 ] ++ [ 4 5 6 ] ++ [ 7 8 9 ]) ( [ @@ -168,10 +115,7 @@ ] ++ (if foo then [ bar ] else [ baz ]) ++ [ ] - ++ (optionals condition [ - more - items - ]) + ++ (optionals condition [ more items ]) ) # Test precedence @@ -236,25 +180,7 @@ ) # Indentation with parenthesized multiline function call - ( - [ - 1 - 2 - 3 - ] - ++ (isOneOf item [ - 1 - 2 - 3 - 4 - ]) - ++ isOneOf item [ - 1 - 2 - 3 - 4 - ] - ) + ([ 1 2 3 ] ++ (isOneOf item [ 1 2 3 4 ]) ++ isOneOf item [ 1 2 3 4 ]) # Interaction with function calls ( g { diff --git a/test/diff/pattern/out-pure.nix b/test/diff/pattern/out-pure.nix index 68642699..f4a6068d 100644 --- a/test/diff/pattern/out-pure.nix +++ b/test/diff/pattern/out-pure.nix @@ -50,11 +50,7 @@ ) ( { - a ? [ - 1 - 2 - 3 - ], + a ? [ 1 2 3 ], b ? { # ... }, diff --git a/test/diff/with/out-pure.nix b/test/diff/with/out-pure.nix index 9c71920b..5671082d 100644 --- a/test/diff/with/out-pure.nix +++ b/test/diff/with/out-pure.nix @@ -33,11 +33,7 @@ { a = with b; # comment - [ - 1 - 2 - 3 - ]; + [ 1 2 3 ]; } { a = @@ -51,16 +47,8 @@ } ([ 1 ]) (with a; [ 1 ]) - ([ - 1 - 2 - 3 - ]) - (with a; [ - 1 - 2 - 3 - ]) + ([ 1 2 3 ]) + (with a; [ 1 2 3 ]) (with a; with b; with c; [ 1 ]) (with a; with b; with c; { a = 1; }) ( @@ -90,46 +78,24 @@ } ) { a = with b; with b; with b; 1; } - { - binPath = - with pkgs; - makeBinPath ([ - rsync - util-linux - ]); - } + { binPath = with pkgs; makeBinPath ([ rsync util-linux ]); } (with a; { }) - (with a; [ - 1 - 2 - 3 - ]) + (with a; [ 1 2 3 ]) (with a; if null then true else false) ( with a; let in - [ - 1 - 2 - 3 - ] + [ 1 2 3 ] ) ( { - gst_plugins ? with gst_all_1; [ - gst-plugins-good - gst-plugins-ugly - ], + gst_plugins ? with gst_all_1; [ gst-plugins-good gst-plugins-ugly ], more ? with stuff; let in - [ - 1 - 2 - 3 - ], + [ 1 2 3 ], things ? with a; if null then true else false, things ? with a; @@ -142,11 +108,7 @@ with stuff; let in - [ - 1 - 2 - 3 - ]; + [ 1 2 3 ]; things = with a; if null then true else false; things = with a; diff --git a/test/diff/with/out.nix b/test/diff/with/out.nix index dbaea7e0..11054e81 100644 --- a/test/diff/with/out.nix +++ b/test/diff/with/out.nix @@ -33,11 +33,7 @@ { a = with b; # comment - [ - 1 - 2 - 3 - ]; + [ 1 2 3 ]; } { a = @@ -51,16 +47,8 @@ } ([ 1 ]) (with a; [ 1 ]) - ([ - 1 - 2 - 3 - ]) - (with a; [ - 1 - 2 - 3 - ]) + ([ 1 2 3 ]) + (with a; [ 1 2 3 ]) (with a; with b; with c; [ 1 ]) (with a; with b; with c; { a = 1; }) ( @@ -101,21 +89,13 @@ ]); } (with a; { }) - (with a; [ - 1 - 2 - 3 - ]) + (with a; [ 1 2 3 ]) (with a; if null then true else false) ( with a; let in - [ - 1 - 2 - 3 - ] + [ 1 2 3 ] ) ( { @@ -127,11 +107,7 @@ with stuff; let in - [ - 1 - 2 - 3 - ], + [ 1 2 3 ], things ? with a; if null then true else false, things ? with a;