···3737- invalid or potentially risky string interpolations
3838- useless parens in infix exprs
3939- unused function params
4040+- manual map over list
4141+- merge inherit
4242+- merge inherit-from
40434144Extensions
4245----------
+62-22
readme.md
···2233> Lints and suggestions for the Nix programming language.
4455-`statix` highlights antipatterns in Nix code. `statix fix`
55+`statix` highlights antipatterns in Nix code. `statix --fix`
66can fix several such occurrences.
7788For the time-being, `statix` works only with ASTs
99produced by the `rnix-parser` crate and does not evaluate
1010any nix code (imports, attr sets etc.).
11111212-## Installation
1212+## Examples
13131414-`statix` is available via a nix flake:
1414+```shell
1515+$ statix tests/c.nix
1616+[W04] Warning: Assignment instead of inherit from
1717+ ╭─[tests/c.nix:2:3]
1818+ │
1919+ 2 │ mtl = pkgs.haskellPackages.mtl;
2020+ · ───────────────┬───────────────
2121+ · ╰───────────────── This assignment is better written with inherit
2222+───╯
15232424+$ statix --fix --dry-run tests/c.nix
2525+--- tests/c.nix
2626++++ tests/c.nix [fixed]
2727+@@ -1,6 +1,6 @@
2828+ let
2929+- mtl = pkgs.haskellPackages.mtl;
3030++ inherit (pkgs.haskellPackages) mtl;
3131+ in
3232+ null
1633```
1717-nix run git+https://git.peppe.rs/languages/statix
18341919-# or
3535+## Installation
3636+3737+`statix` is available via a nix flake:
20383939+```shell
4040+# build from source
2141nix build git+https://git.peppe.rs/languages/statix
2242./result/bin/statix --help
4343+4444+# statix also provides a flake app
4545+nix run git+https://git.peppe.rs/languages/statix -- --help
4646+4747+# save time on builds using cachix
4848+cachix use statix
2349```
24502551## Usage
26522727-```
2828-statix 0.1.0
5353+Basic usage is as simple as:
29543030-Akshay <nerdy@peppe.rs>
5555+```shell
5656+# recursively finds nix files and raises lints
5757+statix /path/to/dir
31583232-Lints and suggestions for the Nix programming language
5959+# ignore generated files, such as Cargo.nix
6060+statix /path/to/dir -i '*Cargo.nix'
33613434-USAGE:
3535- statix [FLAGS] [OPTIONS] [--] [TARGET]
6262+# see `statix -h` for a full list of options
6363+```
36643737-ARGS:
3838- <TARGET> File or directory to run statix on [default: .]
6565+Certain lints have suggestions. Apply suggestions back to
6666+the source with:
39674040-FLAGS:
4141- -d, --dry-run Do not fix files in place, display a diff instead
4242- -f, --fix Find and fix issues raised by statix
4343- -h, --help Print help information
4444- -V, --version Print version information
6868+```shell
6969+statix --fix /path/to/file
45704646-OPTIONS:
4747- -i, --ignore <IGNORE>... Globs of file patterns to skip
4848- -o, --format <FORMAT> Output format. Supported values: errfmt, json (on feature flag only)
7171+# show diff, do not write to file
7272+statix --fix --dry-run /path/to/file
7373+```
7474+7575+`statix` supports a variety of output formats; standard,
7676+json and errfmt:
7777+7878+```shell
7979+statix /path/to/dir -o json
8080+statix /path/to/dir -o errfmt # singleline, easy to integrate with vim
4981```
50825183## Architecture
···5587- `bin`: the CLI/entrypoint
5688- `lib`: library of lints and utilities to define these
5789 lints
9090+- `vfs`: virtual filesystem
5891- `macros`: procedural macros to help define a lint
59926093### `bin`
···70103those lints. It should be easy for newcomers to write lints
71104without being familiar with the rest of the codebase.
72105106106+### `vfs`
107107+108108+VFS is an in-memory filesystem. It provides cheap-to-copy
109109+handles (`FileId`s) to access paths and file contents.
110110+73111### `macros`
7411275113This crate intends to be a helper layer to declare lints and
···7911780118- Offline documentation for each lint
81119- Test suite for lints and suggestions
8282-- Output singleline/errfmt + vim plugin
120120+- Vim plugin (qf list population, apply suggestions)
121121+- Resolve imports and scopes for better lints
122122+- Add silent flag that exits with status