XasCode/terrafile

View on GitHub
.husky/commit-msg

Summary

Maintainability
Test Coverage
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Check if detect-secrets is installed
if ! command -v detect-secrets &> /dev/null
then
    echo "Warning: detect-secrets is not installed."
    echo "!!! detect-secrets will not be run."
    exit 0
fi
# Check if pyahocorasick is installed (word-list)
if ! python -c "import ahocorasick" &> /dev/null
then
    echo "Warning: pyahocorasick is not installed."
    echo "!!! detect-secrets will not be run."
    exit 0
fi

# if there is no baseline, create one
if [ ! -e .secrets.baseline ]; then
    echo "Creating baseline..."
    detect-secrets scan --no-verify > .secrets.baseline
fi

echo "Running detect-secrets on commit-msg..."
# Scans the commit message.
detect-secrets scan --no-verify --string "$@" > /dev/null