更新.codeclimate.yml以使用Python 3以及其他语言

时间:2018-02-20 18:10:53

标签: yaml code-climate

我目前有一个.codeclimate.yml,其开头如下:

---
engines:
  duplication:
    enabled: true
    config:
      languages:
      - ruby
      - javascript
      - python
      - php

也就是说,CodeClimate被配置为适用于包括Python在内的多种语言。然而,我在https://github.com/codeclimate/codeclimate-duplication/issues/129中描述了问题,CodeClimate认为代码在Python 2中,并在Python的新功能(如f-strings)上引发SyntaxError。按照该链接的说明,我想按如下方式更新.codeclimate.yml

engines:
  duplication:
    enabled: true
    config:
      languages:
        ruby:
        javascript:
        python:
          python_version: 3
        php:

因此,它不是一系列语言,而是一个映射,其中只有python键具有python_version的子映射。

然而,我无法从文档中确认这是否是更新.codeclimate.yml的正确方法。这会有用吗?

1 个答案:

答案 0 :(得分:0)

https://docs.codeclimate.com/docs/duplication#section-configure-the-engine上的示例中,确实可以以这种方式编写languages密钥,并且运行CodeClimate CLI命令codeclimate validate-config表示它是有效的。