ak9im/.pre-commit-config.yaml
leo 01cdd03dac
p2: implement file reading+basic data operations
also, update .pre-commit-config.yaml to:
* first change to ./p2, then run the tests (pre-commit deliberately does
  not allow this by design [1])
* for the above, the https://github.com/dnephin/pre-commit-golang repo
  had to be dropped as it does not allow any customisation either.

also, add some flake updates (would be better split into another commit,
I know):
* use baseurl var
* add statix to shell packages
* fix building p1

refs:
[1]: https://github.com/pre-commit/pre-commit/issues/1110
2023-02-24 23:50:13 +01:00

71 lines
1.9 KiB
YAML

---
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-merge-conflict
- repo: meta
hooks:
- id: check-hooks-apply
- repo: local
hooks:
- id: statix
name: statix
entry: statix check .
always_run: false
pass_filenames: false
files: '\.*.nix$'
language: system
- id: nix-fmt
name: nix fmt
entry: nix fmt -- --check .
always_run: false
pass_filenames: false
files: '\.*.nix$'
language: system
- id: flake-check
name: nix flake check
entry: nix flake check --keep-going
always_run: false
pass_filenames: false
files: "flake.(nix|lock)$"
language: system
- id: go-mod-tidy
name: go-mod-tidy
entry: bash -c 'cd ./p2 && go mod tidy'
files: '\.(go|mod|sum)$'
language: system
- id: go-unit-tests
name: go-unit-tests
entry: bash -c "cd ./p2 && go test -v ./..."
files: '\.go$'
language: system
- id: golangci-lint
name: golangci-lint
entry: bash -c 'cd p2 && golangci-lint run'
# types: [go]
pass_filenames: false
language: system
- id: go-build
name: go-build
entry: bash -c 'cd ./p2 && go build -v .'
language: system
- id: nix-build-py
name: nix build py
entry: nix build .#p1
pass_filenames: false
# trigger this hook on changes to any of nix (also flake.lock) or
# python files.
files: '\.*.(nix|lock|py)$'
language: system
- id: nix-build-go
name: nix build go
entry: nix build .#p2
pass_filenames: false
# trigger this hook on changes to any of nix (also flake.lock) files
# and go's mod or sum files
files: '\.*.(nix|lock|mod|sum)$'
language: system