add .pre-commit-config.yaml,.yamllint
All checks were successful
continuous-integration/drone/push Build is passing

* also add readme badge for pre-commit
This commit is contained in:
surtur 2022-09-28 16:58:01 +02:00
parent 2e976b7f6b
commit dd75ae2def
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI
3 changed files with 54 additions and 0 deletions

40
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,40 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
exclude: .drone.yml # drone's yaml is somewhat strange sometimes
- repo: local
hooks:
- id: hugo-version-check
name: hugo version check
entry: |
bash -c "
files='.drone.yml Dockerfile'
count=$(grep -oE '( |hugo-v)[0-9].[0-9].[0-9].[0-9]' $files | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/hugo-v//g' | uniq | wc -l)
if [ $count -gt 1 ]; then
echo hugo versions inconsistent:
grep -noE --color=always '( |hugo-v)[0-9].[0-9].[0-9].[0-9]' $files
exit 1
fi
"
language: system
pass_filenames: false
- id: check-compose-file
name: check compose file
language: system
entry: docker-compose -f docker-compose.yml config
pass_filenames: false
- id: yamllint
name: yamllint
language: system
entry: yamllint .
pass_filenames: false
- repo: https://git.dotya.ml/wanderer/hadolint-pre-commit
rev: v0.0.1
hooks:
- id: hadolint-container
...

13
.yamllint Normal file
View File

@ -0,0 +1,13 @@
---
yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'
rules:
line-length:
level: warning
# vim: ft=yaml bs=2 ts=2
...

View File

@ -1,5 +1,6 @@
# [`docs`](https://git.dotya.ml/dotya.ml/docs/src/branch/master)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Build Status](https://drone.dotya.ml/api/badges/dotya.ml/docs/status.svg)](https://drone.dotya.ml/dotya.ml/docs)
sawce of the dotya.ml's docs site.