有一个 serverless.yaml
文件,其中包含如下行:
VpcId: !Ref MyVpc
Yaml 文件通过 check-yaml
git
钩子(Hook)进行验证,该钩子(Hook)由 pre-commit
命令调用。因此,预提交运行 --all-files
运行失败并出现错误:
could not determine a constructor for the tag '!Ref'
in "serverless.yml", line 172, column 29
有没有办法配置check-yaml
来跳过此错误?
最佳答案
hooks:
- id: check-yaml
args: ['--unsafe']
应该可以解决问题。它只是检查语法而不是尝试加载 YAML。
关于python - 如何从 check-yaml git hook 中排除 !Ref 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59413979/