Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,39 @@ cobra: $(COBRA)
$(COBRA) help
```

### Default git hooks

The dev shell installs the following git hooks automatically:

| Hook | Stage | Description |
| --- | --- | --- |
| `fmt` | `pre-commit` | Runs `make fmt` |
| `lint` | `pre-commit` | Runs `make lint` |
| `osv-scanner`| `pre-commit` | Runs `make scan` on dependency file changes |
| `commitlint` | `commit-msg` | Validates commit messages against [Conventional Commits](https://www.conventionalcommits.org/) (disabled by default) |

To enable the `commitlint` hook, set `commitlint.enable = true` in `preCommitHooks` and add a `.commitlintrc.yml` to the project root:

```yaml
extends:
- "@commitlint/config-conventional"
rules:
type-enum:
- 2
- always
- - feat
- fix
- docs
- chore
- refactor
- test
- ci
- perf
- revert
```

All default hooks can be disabled per-project via `preCommitHooks` (see below).

### Customizing the dev shell

Modify `flake.nix` to adjust Go version, packages, and pre-commit hooks:
Expand Down
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
files = "\\.(mod|sum)$|requirements\\.txt$";
pass_filenames = false;
};
commitlint = mkDefaultAttrs {
enable = false;
entry = "${pkgs.commitlint}/bin/commitlint --edit";
stages = ["commit-msg"];
pass_filenames = false;
};
};
gitHooks = git-hooks.lib.${system}.run {
src = nixpkgs.path;
Expand Down
Loading