Merge pull request #44 from l0b0/feat/pre-commit-hook

feat: Provide pre-commit hook configuration and docs
This commit is contained in:
Astro 2022-12-05 14:25:53 +01:00 committed by GitHub
commit 894506ca23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 `_`