【发布时间】:2019-11-18 19:36:04
【问题描述】:
我正在使用this 库尝试向我的项目添加预提交挂钩。需要考虑的内容很多,我认为我想要的预提交检查不需要他们的大多数示例使用的大范围。我想做的就是运行一个 python 文件。取决于该文件是否退出/完成而没有问题(IE 没有引发异常)是我想要允许或禁止提交的内容。我做了一个.pre-commit-config.yaml,但我不知道如何让它只运行一个文件。
我基本上想输入git commit -m "whatever" 以自动运行python myfile.py
这是我目前所拥有的:
repos:
- repo: local
hooks:
- id: translation-file-check
name: Check Translation Files Are Aligned
description: This hook ensures that all translation files share the same set of keys and generates a CSV if there are no issues
language: python
entry: "./dir/subdir/myfile.py"
但我收到以下错误:.An unexpected error has occurred: OSError: [WinError 193] %1 is not a valid Win32 application
我认为是因为它期望这个 .py 文件是 .exe 或其他东西,即使我将 language 设置为 python...
【问题讨论】:
标签: git pre-commit-hook pre-commit.com