Add pre-commit hooks of our own
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Adds some basic near-universal checks and shellcheck
This commit is contained in:
parent
9a0ea5ca85
commit
5c7dc7758b
14
.pre-commit-config.yaml
Normal file
14
.pre-commit-config.yaml
Normal 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
|
16
Makefile
16
Makefile
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user