pre-commit: optimise local hook triggers
All checks were successful
continuous-integration/drone/push Build is passing

* rm 'require_serial = false' occurences as that's the default value,
  which makes it redundant here.
* do not "always_run" hooks
* only run relevant local hooks when pertaining files/file groups have
  changed, e.g. there is no need to run statix linter when no nix files
  have changed or equally it is not necessary to run 'nix build' when
  none of the flake files (flake.{nix,lock}), any '*.nix' or go source,
  mod or sum files have changed.
  all of the above results in much faster pre-commit runs, i.e. shorter
  feedback loops, i.e. faster iteration cycles.
This commit is contained in:
surtur 2022-05-24 12:20:52 +02:00
parent dabb229e07
commit c3d18b5250
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -16,23 +16,25 @@ repos:
- id: statix - id: statix
name: statix name: statix
entry: statix check . entry: statix check .
always_run: false
pass_filenames: false pass_filenames: false
files: '\.*.nix$'
language: system language: system
- id: nixpkgs-fmt - id: nixpkgs-fmt
require_serial: false
name: nixpkgs-fmt name: nixpkgs-fmt
entry: ./check-fmt entry: ./check-fmt
always_run: false
pass_filenames: false pass_filenames: false
files: '\.*.nix$'
language: system language: system
- id: flake-check - id: flake-check
require_serial: false
name: nix flake check name: nix flake check
entry: nix flake check --impure entry: nix flake check --impure
always_run: false
pass_filenames: false pass_filenames: false
files: "flake.nix" files: "flake.(nix|lock)$"
language: system language: system
- id: addlicense - id: addlicense
require_serial: false
name: addlicence -check name: addlicence -check
entry: > entry: >
go run github.com/google/addlicense@v1.0.0 -check -v go run github.com/google/addlicense@v1.0.0 -check -v
@ -63,4 +65,7 @@ repos:
name: nix build name: nix build
entry: nix build .#go-xkcdreader entry: nix build .#go-xkcdreader
pass_filenames: false pass_filenames: false
# trigger this hook on changes to any of nix (also flake.lock) files
# and go's src, mod or sum files
files: '\.*.(nix|lock|go|mod|sum)$'
language: system language: system