From 549da30729a2f4734b343a58f3f866e616d2fc90 Mon Sep 17 00:00:00 2001 From: Steffen Pankratz Date: Fri, 17 Jan 2025 20:14:37 +0100 Subject: [PATCH] Remove obsolete Autohook scripts. Autohook was replaced with pre-commit (see https://github.com/unixorn/ha-mqtt-discoverable/pull/34) Signed-off-by: Steffen Pankratz --- hooks/autohook.sh | 100 ------------------ .../001-clean-up-pyc-and-pyo-files | 4 - .../pre-commit/001-clean-up-pyc-and-pyo-files | 4 - .../002-format-python-files-with-black | 13 --- hooks/scripts/format-python-files-with-black | 13 --- 5 files changed, 134 deletions(-) delete mode 100755 hooks/autohook.sh delete mode 100755 hooks/post-checkout/001-clean-up-pyc-and-pyo-files delete mode 100755 hooks/pre-commit/001-clean-up-pyc-and-pyo-files delete mode 100755 hooks/pre-commit/002-format-python-files-with-black delete mode 100755 hooks/scripts/format-python-files-with-black diff --git a/hooks/autohook.sh b/hooks/autohook.sh deleted file mode 100755 index 82bf18b..0000000 --- a/hooks/autohook.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env bash - -# Autohook -# A very, very small Git hook manager with focus on automation -# Contributors: https://github.com/Autohook/Autohook/graphs/contributors -# Version: 2.3.0 -# Website: https://github.com/Autohook/Autohook - - -echo() { - builtin echo "[Autohook] $@"; -} - - -install() { - hook_types=( - "applypatch-msg" - "commit-msg" - "post-applypatch" - "post-checkout" - "post-commit" - "post-merge" - "post-receive" - "post-rewrite" - "post-update" - "pre-applypatch" - "pre-auto-gc" - "pre-commit" - "pre-push" - "pre-rebase" - "pre-receive" - "prepare-commit-msg" - "update" - ) - - repo_root=$(git rev-parse --show-toplevel) - hooks_dir="$repo_root/.git/hooks" - autohook_linktarget="../../hooks/autohook.sh" - for hook_type in "${hook_types[@]}" - do - hook_symlink="$hooks_dir/$hook_type" - ln -sf $autohook_linktarget $hook_symlink - done -} - - -main() { - calling_file=$(basename $0) - - if [[ $calling_file == "autohook.sh" ]] - then - command=$1 - if [[ $command == "install" ]] - then - install - fi - else - repo_root=$(git rev-parse --show-toplevel) - hook_type=$calling_file - symlinks_dir="$repo_root/hooks/$hook_type" - files=("$symlinks_dir"/*) - number_of_symlinks="${#files[@]}" - if [[ $number_of_symlinks == 1 ]] - then - if [[ "$(basename ${files[0]})" == "*" ]] - then - number_of_symlinks=0 - fi - fi - echo "Looking for $hook_type scripts to run...found $number_of_symlinks!" - if [[ $number_of_symlinks -gt 0 ]] - then - hook_exit_code=0 - for file in "${files[@]}" - do - scriptname=$(basename $file) - echo "BEGIN $scriptname" - if [[ "${AUTOHOOK_DEBUG-}" == '' ]]; then - eval "\"$file\"" &>/dev/null - else - eval "\"$file\"" - fi - script_exit_code="$?" - if [[ "$script_exit_code" != 0 ]] - then - hook_exit_code=$script_exit_code - fi - echo "FINISH $scriptname" - done - if [[ $hook_exit_code != 0 ]] - then - echo "A $hook_type script yielded negative exit code $hook_exit_code" - exit $hook_exit_code - fi - fi - fi -} - - -main "$@" diff --git a/hooks/post-checkout/001-clean-up-pyc-and-pyo-files b/hooks/post-checkout/001-clean-up-pyc-and-pyo-files deleted file mode 100755 index 8440194..0000000 --- a/hooks/post-checkout/001-clean-up-pyc-and-pyo-files +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -find . -iname '*.pyc' -delete -find . -iname '*.pyo' -delete diff --git a/hooks/pre-commit/001-clean-up-pyc-and-pyo-files b/hooks/pre-commit/001-clean-up-pyc-and-pyo-files deleted file mode 100755 index 8440194..0000000 --- a/hooks/pre-commit/001-clean-up-pyc-and-pyo-files +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -find . -iname '*.pyc' -delete -find . -iname '*.pyo' -delete diff --git a/hooks/pre-commit/002-format-python-files-with-black b/hooks/pre-commit/002-format-python-files-with-black deleted file mode 100755 index f25ae7b..0000000 --- a/hooks/pre-commit/002-format-python-files-with-black +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -# -# Run black on all files in the repo - -set -o pipefail - -pydirs=() -for i in $(find . -iname '*.py' -exec dirname '{}' ';' | sort | uniq) -do - pydirs+=($i) -done - -black "${pydirs[@]}" diff --git a/hooks/scripts/format-python-files-with-black b/hooks/scripts/format-python-files-with-black deleted file mode 100755 index f25ae7b..0000000 --- a/hooks/scripts/format-python-files-with-black +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -# -# Run black on all files in the repo - -set -o pipefail - -pydirs=() -for i in $(find . -iname '*.py' -exec dirname '{}' ';' | sort | uniq) -do - pydirs+=($i) -done - -black "${pydirs[@]}"