From a9287bc66c5c0eaa52f78cd2ff40285c9d629ae7 Mon Sep 17 00:00:00 2001 From: ooooo <3164076421@qq.com> Date: Mon, 20 Apr 2026 14:19:26 +0800 Subject: [PATCH] fix(pre-commit): preserve matched filenames in no-underscore-md hook Signed-off-by: ooooo <3164076421@qq.com> --- .../{{cookiecutter.project_slug}}/.pre-commit-config.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github_repo_template/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/github_repo_template/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index 7554cde0..ef1ea46d 100644 --- a/github_repo_template/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/github_repo_template/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -37,6 +37,7 @@ repos: - id: no-underscore-md name: "Disallow '_' in Markdown filenames" language: system + # With `bash -c`, the first extra arg becomes `$0`, so `--` keeps matched filenames in `"$@"`. entry: | bash -c ' # Report the offending files @@ -45,7 +46,7 @@ repos: echo " - $file (use hyphens instead)" >&2 done exit 1 - ' + ' -- files: '.*\/[^\/]*_[^\/]*\.md$' exclude: '^\.github/' types: [file]