From ffd5767b42c5e8dd980dc666d8b3231e1313cd4f Mon Sep 17 00:00:00 2001 From: Mikhail Iudin Date: Tue, 25 Apr 2023 18:17:59 +0200 Subject: [PATCH] GO-879 Add pre-commit secrets linter --- .githooks/pre-push | 17 +++++++++++++++++ .pre-commit-config.yaml | 9 +++++---- 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100755 .githooks/pre-push diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 000000000..996f5883f --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +INSTALL_PYTHON=python3 +ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-push) +# 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. Please visit https://wiki.anytype.io/doc/mandatory-git-hooks-5rQt1Qyw7k ' 1>&2 + exit 1 +fi diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d585914d..43f091d04 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,5 @@ -- repo: git://github.com/dnephin/pre-commit-golang - rev: master - hooks: - - id: go-fmt +repos: + - repo: https://github.com/zricethezav/gitleaks + rev: v8.16.0 + hooks: + - id: gitleaks \ No newline at end of file