Scan Nix files for dead code
Go to file
2021-12-08 01:15:28 +01:00
src implement editing source files 2021-12-08 01:15:28 +01:00
.gitignore PoC 2021-12-06 00:04:52 +01:00
Cargo.lock implement no_lambda_arg+no_underscore options 2021-12-07 22:10:44 +01:00
Cargo.toml implement no_lambda_arg+no_underscore options 2021-12-07 22:10:44 +01:00
flake.lock PoC 2021-12-06 00:04:52 +01:00
flake.nix flake.nix: remove zombie code 2021-12-06 21:58:51 +01:00
LICENSE LICENSE: add 2021-12-06 00:13:14 +01:00
README.md README: extend 2021-12-07 00:53:39 +01:00
test.nix implement no_lambda_arg+no_underscore options 2021-12-07 22:10:44 +01:00

deadnix

Scan .nix files for dead code (unused variable bindings).

Usage with Nix Flakes

$ nix run github:astro/deadnix test.nix
test.nix:1:
> unusedArgs@{ unusedArg, usedArg, ... }:
> ^^^^^^^^^^   ^^^^^^^^^
> |            |
> |            unused lambda pattern: unusedArg
> unused lambda @-binding: unusedArgs
test.nix:5:
>   unused = "fnord";
>   ^^^^^^
>   |
>   unused let in binding: unused
test.nix:3:
>   inherit (builtins) unused_inherit;
>                      ^^^^^^^^^^^^^^
>                      |
>                      unused let in inherit binding: unused_inherit
test.nix:12:
>   x = { unusedArg2, x ? args.y, ... }@args: used1 + x;
>         ^^^^^^^^^^
>         |
>         unused lambda pattern: unusedArg2

What if the produced reports are wrong?

Please open an issue. Do not forget to include the .nix code that produces incorrect results.

Commercial Support

The author can be hired to implement the features that you wish, or to integrate this tool into your toolchain.