Skip to content

Synthetica9/nix-linter

Repository files navigation

nix-linter

Build Status

nix-linter is a program to check for several common mistakes or stylistic errors in Nix expressions, such as unused arguments, empty let blocks, etcetera.

Usage

First, setup cachix:

cachix use nix-linter

Then clone the repo and cd into it:

git clone https://github.com/Synthetica9/nix-linter
cd nix-linter

Finally, you can run the application with:

$(nix-build -A nix-linter)/bin/nix-linter --help
The nix-linter program

nix-linter [OPTIONS] [FILES]

Common flags:
  -W --check=ITEM       checks to enable
  -j --json             Use JSON output
  -J --json-stream      Use a newline-delimited stream of JSON objects
                        instead of a JSON list (implies --json)
  -r --recursive        Recursively walk given directories (like find)
  -o --out[=FILE]       File to output to
  -h --help-for=CHECKS
  -? --help             Display help message
  -V --version          Print version information
  -v --verbose          Loud verbosity
  -q --quiet            Quiet verbosity

Available checks (See `nix-linter --help-for [CHECK]` for more details):
    DIYInherit
    EmptyInherit
    EmptyLet
    EtaReduce
    FreeLetInFunc
    LetInInheritRecset
    ListLiteralConcat
    NegateAtom
    SequentialLet
    SetLiteralUpdate
    UnfortunateArgName
    UnneededRec
    UnusedArg
    UnusedLetBind
    UpdateEmptySet
    AlphabeticalArgs (disabled by default)
    AlphabeticalBindings (disabled by default)
    BetaReduction (disabled by default)
    EmptyVariadicParamSet (disabled by default)
    UnneededAntiquote (disabled by default)