From d72209a77c8ea300bb05cb0ebb57710c1e7cdc59 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Thu, 4 Dec 2025 20:37:16 +0100 Subject: [PATCH] pre-commit: add hook to remove empty directories Automatically finds and removes empty directories (excluding .git) during pre-commit runs to keep the repo clean. --- .pre-commit-config.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 220bb7e..20af177 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -269,6 +269,18 @@ repos: - id: shellcheck args: [--severity=warning] + # =========================================================================== + # REMOVE EMPTY DIRECTORIES - Clean up empty folders in the repo + # =========================================================================== + - repo: local + hooks: + - id: remove-empty-dirs + name: remove empty directories + entry: find . -type d -empty -not -path './.git/*' -delete -print + language: system + pass_filenames: false + always_run: true + # =========================================================================== # COMMITIZEN - Conventional commits (optional) # ===========================================================================