Search code examples
yamlcode-climate

Updating .codeclimate.yml to use Python 3 as well as other languages


I currently have a .codeclimate.yml which starts as follows:

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

That is, CodeClimate is configured to work for several languages including Python. I'm running into the issue, however, described at https://github.com/codeclimate/codeclimate-duplication/issues/129, that CodeClimate thinks the code is in Python 2 and raises SyntaxErrors on Python's newer features like f-strings. Following the instructions at that link, I'd like to update the .codeclimate.yml as follows:

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

So instead of a sequence of languages, it would become a mapping in which only the python key has a sub-mapping with the python_version.

I was unable to confirm from the documentation, however, whether this is the right way to update the .codeclimate.yml. Would this work?


Solution

  • From the example on https://docs.codeclimate.com/docs/duplication#section-configure-the-engine, it does indeed seem possible to write the languages key in this way, and running the CodeClimate CLI command codeclimate validate-config indicates that it is valid.