feat: add pre-commit and tasks
This commit is contained in:
parent
34deb2125f
commit
837fdfed30
5 changed files with 88 additions and 4 deletions
26
.github/lint/.yamllint.yaml
vendored
Normal file
26
.github/lint/.yamllint.yaml
vendored
Normal 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
33
.pre-commit-config.yaml
Normal 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)
|
|
@ -39,7 +39,7 @@ tasks:
|
||||||
msg: "nixos-rebuild not found"
|
msg: "nixos-rebuild not found"
|
||||||
- sh: which nvd
|
- sh: which nvd
|
||||||
msg: "nvd not found"
|
msg: "nvd not found"
|
||||||
|
|
||||||
.prompt_to_continue:
|
.prompt_to_continue:
|
||||||
internal: true
|
internal: true
|
||||||
prompt: Do you want to continue applying this configuration?
|
prompt: Do you want to continue applying this configuration?
|
||||||
|
|
22
.taskfiles/pre-commit/Taskfile.yaml
Normal file
22
.taskfiles/pre-commit/Taskfile.yaml
Normal 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
|
|
@ -2,15 +2,18 @@
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
includes:
|
includes:
|
||||||
sops:
|
sop:
|
||||||
taskfile: ".taskfiles/sops"
|
taskfile: ".taskfiles/sops"
|
||||||
dir: .taskfiles/sops
|
dir: .taskfiles/sops
|
||||||
nix:
|
nix:
|
||||||
taskfile: ".taskfiles/nix"
|
taskfile: ".taskfiles/nix"
|
||||||
dir: "{{.ROOT_DIR}}"
|
dir: "{{.ROOT_DIR}}"
|
||||||
|
pre:
|
||||||
|
taskfile: ".taskfiles/pre-commit"
|
||||||
|
dir: "{{.ROOT_DOR}}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
default:
|
default:
|
||||||
silent: true
|
silent: true
|
||||||
cmds:
|
cmds:
|
||||||
- task -l
|
- task -l
|
||||||
|
|
Reference in a new issue