diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 00000000..1f430eea --- /dev/null +++ b/.gitconfig @@ -0,0 +1 @@ +git config -f .gitconfig core.hooksPath .githooks \ No newline at end of file diff --git a/.githooks/commit-msg b/.githooks/commit-msg new file mode 100755 index 00000000..e5695cbc --- /dev/null +++ b/.githooks/commit-msg @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# File generated by pre-commit: https://pre-commit.com +# ID: 138fd403232d2ddd5efb44317e38bf03 + +# start templated +INSTALL_PYTHON=/home/linuxbrew/.linuxbrew/opt/pre-commit/libexec/bin/python3 +ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=commit-msg) +# end templated + +HERE="$(cd "$(dirname "$0")" && pwd)" +ARGS+=(--hook-dir "$HERE" -- "$@") + +if [ -x "$INSTALL_PYTHON" ]; then + exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}" +elif command -v pre-commit > /dev/null; then + exec pre-commit "${ARGS[@]}" +else + echo '`pre-commit` not found. Did you forget to activate your virtualenv?' 1>&2 + exit 1 +fi diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 00000000..1fb71bef --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# File generated by pre-commit: https://pre-commit.com +# ID: 138fd403232d2ddd5efb44317e38bf03 + +# start templated +INSTALL_PYTHON=/home/linuxbrew/.linuxbrew/opt/pre-commit/libexec/bin/python3 +ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-commit) +# end templated + +HERE="$(cd "$(dirname "$0")" && pwd)" +ARGS+=(--hook-dir "$HERE" -- "$@") + +if [ -x "$INSTALL_PYTHON" ]; then + exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}" +elif command -v pre-commit > /dev/null; then + exec pre-commit "${ARGS[@]}" +else + echo '`pre-commit` not found. Did you forget to activate your virtualenv?' 1>&2 + exit 1 +fi diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..0305c59e --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +repos: + - repo: https://github.com/jorisroovers/gitlint + rev: v0.17.0 + hooks: + - id: gitlint + args: [--ignore, body-is-missing, --contrib=CT1, --msg-filename] + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.5.1 + hooks: + - id: prettier + stages: [commit] diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..126803b1 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +enable-git-hooks: + git config core.hooksPath .githooks + chmod +x .githooks/pre-commit + chmod +x .githooks/commit-msg + $(warning REMEMBER, YOU MUST HAVE REVIEWED THE CUSTOM HOOKS!) \ No newline at end of file