Add pre-commit hooks of our own
continuous-integration/drone/push Build is failing Details

Adds some basic near-universal checks and shellcheck
This commit is contained in:
IamTheFij 2020-09-19 20:07:34 +00:00
parent 9a0ea5ca85
commit 5c7dc7758b
2 changed files with 25 additions and 5 deletions

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

@ -0,0 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args:
- --allow-multiple-documents
- id: check-merge-conflict
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.7.1.1
hooks:
- id: shellcheck

View File

@ -1,13 +1,9 @@
.PHONY: all test clean
all: test shellcheck
all: check test
test: test-negative test-positive
.PHONY: shellcheck
shellcheck:
shellcheck *.sh
.PHONY: test-positive
test-positive:
@echo "Check valid compose file."
@ -19,3 +15,13 @@ test-negative:
./compose-check.sh tests/docker-compose.bad.yml && { echo 'fail'; exit 1; } || echo 'ok'
@echo "Check multiple files. Should error."
./compose-check.sh tests/docker-compose* && { echo 'fail'; exit 1; } || echo 'ok'
# Installs pre-commit hooks
.PHONY: install-hooks
install-hooks:
pre-commit install --install-hooks
# Checks files for encryption
.PHONY: check
check:
pre-commit run --all-files