From a71ff70b06d4f1e3a4e08d3511b0a290cdfd7ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sat, 20 Sep 2025 11:53:11 +0200 Subject: [PATCH] update-pre-commit-config: add .gitignore support Add uninstallable addons to .gitignore, so search tools that skip .gitignore'd content will not have search results polluted by code that is uninstallable. --- tools/update_pre_commit_excluded_addons.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/update_pre_commit_excluded_addons.py b/tools/update_pre_commit_excluded_addons.py index 5b2fec876..a42d635fd 100644 --- a/tools/update_pre_commit_excluded_addons.py +++ b/tools/update_pre_commit_excluded_addons.py @@ -6,6 +6,7 @@ PRE_COMMIT_FILE_PATH = ".pre-commit-config.yaml" COVERAGE_FILE_PATH = ".coveragerc" +GITIGNORE_FILE_PATH = ".gitignore" PRE_COMMIT_EXCLUDE_SEPARATOR = "# NOT INSTALLABLE ADDONS" PRE_COMMIT_EXCLUDE_SEPARATOR_END = "# END NOT INSTALLABLE ADDONS" @@ -108,6 +109,12 @@ def main(addons_dir): # END NOT INSTALLABLE ADDONS .. + In .gitignore + + .. code-block:: text + # NOT INSTALLABLE ADDONS + # END NOT INSTALLABLE ADDONS + """ not_installable_addons_dir = [] addons = os.listdir(addons_dir or ".") @@ -122,6 +129,9 @@ def main(addons_dir): update_not_installable_addons_dir_in_file( not_installable_addons_dir, COVERAGE_FILE_PATH, "{addon_dir}/*", "\n" ) + update_not_installable_addons_dir_in_file( + not_installable_addons_dir, GITIGNORE_FILE_PATH, "/{addon_dir}", "\n" + ) if __name__ == "__main__":