You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check for patterns which fit common builtin/lib functions like map, mapAttrs, genAttrs, etc.
Check for quoted/unquoted URLs (depending on style)
Check if inherit sources are in lexicographic order e.g. { inherit foo; inherit (a) bar; inherit (b) baz; }
Check for eval-time building, e.g. "import from derivation" like import (fetchgit { ... }) or callPackage "${someDerivation}/foo" {}
Check for reading of derivations or store paths, e.g. builtins.readFile "${someDerivation}" since this can either trigger someDerivation to be built at eval time or cause a file-not-found error (it will work if someDerivation just-so-happens to already exist in the store)
Check for potentially-dodgy quoting. Some quote/splice combinations don't interact well together (which?)
Check for "prematurely-forced derivations". I think this comes from builds being triggered due to some string manipulation of derivation paths. For example derivation { foo = "${bar}:${baz}"; ... } could (I think) cause some sort of building to figure out the string representations of bar and baz (if, for example, these were imported from another derivation's output). Not sure if it's an actual issue, has been fixed in newer Nix versions, or if it was just a figment of my imagination...
Check for complicated splice escaping. For example doing things like foo = ''echo "${"$" + "{MY_VAR}"}"'' to work around ${} being special syntax for both Nix and Bash.
Check for unquoted splices, e.g. foo = bar.${baz};, since leaving off quotes is just horrible ;)
Check for let/in and recommend replacing with with or with rec. Presumably controversial, but I don't see the point of let/in in Nix ;)
Check if names are inherited in lexicographic order e.g. { inherit a b c; }
Check if arguments are declared in lexicographic order e.g. { a, b, c }: ...
Check if attributes are defined in lexicographic order e.g. { x = ...; y = ...; z = ...; }
Look for eta-expansions, e.g. map (x: foo bar x) baz could be map (foo bar) baz
Check for "misnamed" arguments. For example in foo = bar: baz { quux = bar; }; the only thing we do to the argument bar is bind it to quux. We could suggest aligning the APIs of foo and baz, by either renaming foo's bar argument to quux or baz's quux argument to bar; in either case we could then use inherit rather than renaming. Renaming bar like this is low impact since it's just an alpha-rename, but if it were a named argument (e.g. foo = { bar }: ...) or if we rename quux then that changes those functions' API.
Look for use-cases of inherit, e.g. { foo = foo; } could be { inherit foo; } and { foo = bar.foo; } could be { inherit (bar) foo; }.
Check for unused let/in bindings
Check for unused function arguments
Check for unused rec, e.g. x = rec { y = "hello"; }; doesn't need the rec; likewise for with rec {...}
The text was updated successfully, but these errors were encountered:
haskell-nix/hnix#136 (comment)
The text was updated successfully, but these errors were encountered: