lints and suggestions for the nix programming language
Go to file
2021-10-24 13:26:37 +05:30
bin rework cli, fix is now a flag, implement dry-run mode 2021-10-24 13:26:37 +05:30
lib add support for json out 2021-10-24 13:24:52 +05:30
macros allow match_kind to accept multiple kinds 2021-10-15 13:06:29 +05:30
vfs minor refactor 2021-10-19 22:27:23 +05:30
.gitignore new lint: manual_inherit 2021-10-02 13:39:39 +05:30
Cargo.lock add support for json out 2021-10-24 13:24:52 +05:30
Cargo.toml add vfs 2021-10-19 15:57:39 +05:30
default.nix add default.nix and shell.nix with flake-compat 2021-10-19 20:46:03 +05:30
flake.lock add default.nix and shell.nix with flake-compat 2021-10-19 20:46:03 +05:30
flake.nix add flake app 2021-10-23 14:16:44 +05:30
notes.txt fix flake builds 2021-10-19 20:39:11 +05:30
readme.md rework cli, fix is now a flag, implement dry-run mode 2021-10-24 13:26:37 +05:30
shell.nix add default.nix and shell.nix with flake-compat 2021-10-19 20:46:03 +05:30

statix

Lints and suggestions for the Nix programming language.

statix highlights antipatterns in Nix code. statix fix can fix several such occurrences.

For the time-being, statix works only with ASTs produced by the rnix-parser crate and does not evaluate any nix code (imports, attr sets etc.).

Installation

statix is available via a nix flake:

nix run git+https://git.peppe.rs/languages/statix

# or

nix build git+https://git.peppe.rs/languages/statix
./result/bin/statix --help

Usage

statix 0.1.0

Akshay <nerdy@peppe.rs>

Lints and suggestions for the Nix programming language

USAGE:
    statix [FLAGS] [OPTIONS] [--] [TARGET]

ARGS:
    <TARGET>    File or directory to run statix on [default: .]

FLAGS:
    -d, --dry-run    Do not fix files in place, display a diff instead
    -f, --fix        Find and fix issues raised by statix
    -h, --help       Print help information
    -V, --version    Print version information

OPTIONS:
    -i, --ignore <IGNORE>...    Globs of file patterns to skip
    -o, --format <FORMAT>       Output format. Supported values: errfmt, json (on feature flag only)

Architecture

statix has the following components:

  • bin: the CLI/entrypoint
  • lib: library of lints and utilities to define these lints
  • macros: procedural macros to help define a lint

bin

This is the main point of interaction between statix and the end user. It's output is human-readable and should also support JSON/errorfmt outputs for external tools to use.

lib

A library of AST-based lints and utilities to help write those lints. It should be easy for newcomers to write lints without being familiar with the rest of the codebase.

macros

This crate intends to be a helper layer to declare lints and their metadata.

TODO

  • Offline documentation for each lint
  • Test suite for lints and suggestions
  • Output singleline/errfmt + vim plugin