feat: Provide pre-commit hook configuration and docs

This commit is contained in:
Victor Engmark 2022-12-05 21:45:54 +13:00
parent 29303ce4c0
commit 60af7e9880
2 changed files with 27 additions and 0 deletions

7
.pre-commit-hooks.yaml Normal file
View File

@ -0,0 +1,7 @@
- id: deadnix
name: deadnix
description: Scan Nix files for dead code
entry: deadnix
args: [--fail]
types: [nix]
language: system

View File

@ -77,6 +77,26 @@ Warning: Unused declarations were found.
$ nix run github:astro/deadnix -- -eq test.nix
```
## Usage with [pre-commit](https://pre-commit.com/)
Add the following to your project's `.pre-commit-config.yaml`:
```yaml
repos:
- repo: https://github.com/astro/deadnix
rev: ID # frozen: VERSION
hooks:
- id: deadnix
#args: [--edit] # Uncomment to automatically modify files
stages: [commit]
```
Replace `ID` and `VERSION` above with the relevant version tag and
commit ID for reference, for example:
```yaml
rev: da39a3ee5e6b4b0d3255bfef95601890afd80709 # frozen: v1.2.3
```
## Behavior
### Renaming of all unused to lambda args to start with `_`