christiangoeschel c1eb61d425
Some checks failed
Post PR Merge Action / integrate (push) Failing after 6s
feat: Add dev tools and helper scripts
2025-02-10 17:08:33 -05:00

22 lines
672 B
Bash
Executable File

#!/bin/bash
# pe-commit absolute file path
PRE_COMMIT_BIN="$(which pre-commit)"
# Check whether pre-commit is installed and executable
if [[ ! -x "${PRE_COMMIT_BIN}" ]]; then
printf "[$(tput setaf 1)$(tput bold)error$(tput sgr0)] %s\n" \
"pre-commit is not installed. Please use 'pip install pre-commit' to install."
exit 1
fi
# Updating pre-commit to ensure hooks in .pre-commit-config.yaml are found
"${PRE_COMMIT_BIN}" autoupdate
if ! "${PRE_COMMIT_BIN}" run --all-files; then
printf "[$(tput setaf 1)$(tput bold)error$(tput sgr0)] %s\n" \
"Linting failed please review above output and fix issues before committing."
exit 1
fi
exit 0