From 4109dcabcd342d36f73ef064f5aa7ab99215f244 Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Tue, 19 May 2020 13:38:40 -0700 Subject: [PATCH] Add pre-commit hooks Fixes #12 --- .pre-commit-config.yaml | 17 +++++++++++++++++ Makefile | 11 +++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..9928bdd --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.0.1 + hooks: + - id: check-merge-conflict + - id: check-yaml + - id: end-of-file-fixer + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.7.1.1 + hooks: + - id: shellcheck + - repo: https://github.com/IamTheFij/docker-pre-commit + rev: v2.0.0 + hooks: + - id: docker-compose-check + - id: hadolint diff --git a/Makefile b/Makefile index f16f13f..bda4ce2 100644 --- a/Makefile +++ b/Makefile @@ -4,10 +4,17 @@ default: test .PHONY: test -test: +test: check docker-compose -f ./tests/docker-compose-private.yml up \ --build --force-recreate \ --abort-on-container-exit --exit-code-from plugin docker-compose -f ./tests/docker-compose-public.yml up \ - --build --force-recreate \ --abort-on-container-exit --exit-code-from plugin + +.PHONY: install-hooks +install-hooks: + pre-commit install + +.PHONY: check +check: + pre-commit run --all-files