Gin*_*sus 14 git pre-commit.com
我想制作一个符合 \xe2\x80\x99s REUSE标准的 Git 存储库。我想使用重用预提交挂钩来帮助确保 I\xe2\x80\x99m 兼容。重用规范要求我创建一个名为 \xe2\x80\x9cLICENSES\xe2\x80\x9d 的文件夹,其中包含我的项目使用的每个许可证。我\xe2\x80\x99m 使用其他几个挂钩,并且我不希望这些挂钩检查或修改文件夹中的任何内容LICENSES/。我希望除重用之外的每个钩子都排除在外LICENSES/。(旁注:目前,重用挂钩似乎不受 排除 的影响LICENSES/,但这可能应该得到修复)。这里\xe2\x80\x99是我迄今为止尝试过的:
exclude: \'^LICENSES/\'\nrepos:\n -\n repo: https://github.com/pre-commit/pre-commit-hooks\n rev: v4.0.1\n hooks:\n - id: check-case-conflict\n - id: end-of-file-fixer\n - id: mixed-line-ending\n - id: trailing-whitespace\n # I\xe2\x80\x99m using identity instead of reuse here for testing and to better\n # illustrate the problem.\n -\n repo: meta\n hooks:\n -\n id: identity\n exclude: "^$"\nRun Code Online (Sandbox Code Playgroud)\n那\xe2\x80\x99 不起作用。看起来除了全局模式之外,每个钩子排除模式也适用。我希望应用每个钩子排除模式而不是全局模式。
\n我可以在每个钩子上使用每个钩子排除模式,除了一个:
\nrepos:\n -\n repo: https://github.com/pre-commit/pre-commit-hooks\n rev: v4.0.1\n hooks:\n -\n id: check-case-conflict\n exclude: &exclude_pattern \'^LICENSES/\'\n -\n id: end-of-file-fixer\n exclude: *exclude_pattern\n -\n id: mixed-line-ending\n exclude: *exclude_pattern\n -\n id: trailing-whitespace\n exclude: *exclude_pattern\n # I\xe2\x80\x99m using identity instead of reuse here for testing and to better\n # illustrate the problem.\n -\n repo: meta\n hooks:\n - id: identity\nRun Code Online (Sandbox Code Playgroud)\n但是,那样我就会重复自己。我认为我可能可以使用合并键更少地重复自己,但我不\xe2\x80\x99t认为这些是受支持的。是否有办法避免重复自己或少重复自己?
\n