feat: add pre-commit and tasks

This commit is contained in:
truxnell 2024-03-18 07:42:52 +11:00
parent 34deb2125f
commit 837fdfed30
5 changed files with 88 additions and 4 deletions

26
.github/lint/.yamllint.yaml vendored Normal file
View file

@ -0,0 +1,26 @@
---
ignore: |
.direnv/
.private/
.vscode/
extends: default
rules:
truthy:
allowed-values: ["true", "false", "on"]
comments:
min-spaces-from-content: 1
line-length: disable
braces:
min-spaces-inside: 0
max-spaces-inside: 1
brackets:
min-spaces-inside: 0
max-spaces-inside: 0
indentation: enable

33
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,33 @@
---
fail_fast: false
repos:
- repo: https://github.com/kamadorueda/alejandra
rev: 3.0.0
hooks:
- id: alejandra-system
- repo: https://github.com/adrienverge/yamllint
rev: v1.32.0
hooks:
- args:
- --config-file
- .github/lint/.yamllint.yaml
id: yamllint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: check-added-large-files
args: [--maxkb=2048]
- id: check-merge-conflict
- id: check-executables-have-shebangs
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- id: remove-crlf
- id: remove-tabs
exclude: (Makefile)

View file

@ -0,0 +1,22 @@
---
version: "3"
vars:
host: $HOSTNAME
tasks:
init:
desc: Initialize pre-commit hooks
cmds:
- pre-commit install --install-hooks
update:
desc: Update pre-commit dependencies
cmds:
- pre-commit autoupdate
run:
desc: Run pre-commit
cmds:
- pre-commit run --all-files

View file

@ -2,12 +2,15 @@
version: "3"
includes:
sops:
sop:
taskfile: ".taskfiles/sops"
dir: .taskfiles/sops
nix:
taskfile: ".taskfiles/nix"
dir: "{{.ROOT_DIR}}"
pre:
taskfile: ".taskfiles/pre-commit"
dir: "{{.ROOT_DOR}}"
tasks:
default: