预先提交check-yaml错误:“预期流中的单个文档”

时间:2017-09-06 11:44:24

标签: yaml pre-commit

我使用prepremit与此.pre-commit-config.yaml文件(提取):

-   repo: https://github.com/pre-commit/pre-commit-hooks
    sha: v0.9.2
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: check-yaml

我遇到了这个错误:

Check Yaml...................Failed
hookid: check-yaml

expected a single document in the stream
  in "modules.yml", line 1, column 1
but found another document
  in "modules.yml", line 4, column 1

我的yaml文件的开头是:

repo: ssh://git.tranquilit.local/odoo-11-oca-tis/OCB.git
root: 8.0
branch: 8.0-tis
---
repo: ssh://git.tranquilit.local/odoo-71-tis/tis-addons.git
origin: tis
branch: 8.0
modules:
    #- attachment_rename
    #- partner_firstname
    - tis_account_analytic_recurrent_invoicing

我尝试使用和不使用引导线---但它只更改错误的行nb。

我在网络上的任何地方都没有找到任何帮助,所以如果有人可以帮助我,我会非常满意!

感谢提前,Herve

2 个答案:

答案 0 :(得分:1)

---在您的文件中启动新的YAML文档。因此,您的文件中有两个YAML文档,这就是错误所抱怨的内容。基于预提交的文档,我假设你想把它变成一个序列:

- repo: ssh://git.tranquilit.local/odoo-11-oca-tis/OCB.git
  root: 8.0
  branch: 8.0-tis
- repo: ssh://git.tranquilit.local/odoo-71-tis/tis-addons.git
  origin: tis
  branch: 8.0
  modules:
    #- attachment_rename
    #- partner_firstname
    - tis_account_analytic_recurrent_invoicing

答案 1 :(得分:1)

问题现在在预提交版本1.1.0中得到解决:https://github.com/pre-commit/pre-commit/issues/635 谢谢你的帮助。