0

我是编码气候的新手,当我在codeclimate上运行我的 github 项目时遇到了这个错误。

codeclimate validate-config
ERROR: Unable to parse: (<unknown>): found unexpected end of stream while scanning a quoted scalar at line 23 column 5

下面是我的.codeclimate.yml文件:

---
machine:
  environment:
    CODECLIMATE_REPO_TOKEN: ab24b326dac817e772c5246823b67af66e2358e51134c33e20aaf7fb228088b0

engines:
  duplication:
    enabled: false
    config:
      languages:
      - python
  fixme:
    enabled: true
  pep8:
    enabled: true
  radon:
    enabled: true
ratings:
  paths:
  - "**.py"
exclude_paths:
  - "docs/*"
  - "examples/*
  -*api/songs/models*
  -*/site-packages/*
  -*markupsafe/*
  -*psycopg2/*
  -*six.py*
  -*sqlalchemy/*
  -*werkzeug/*
  -*stringprep.py*
  -*uuid.py*
  -*ctypes/*
  -*decimal.py*
  -*encodings/*
  -*hmac.py*
  -*asyncio/*
  -*concurrent/*
  -*multiprocessing/*
  -*mimetypes.py*
  -*numbers.py*
  -*pydoc.py*
  -*http/*
  -*app/api/user/__init__.py*
  -*app/api/request/__init__.py*
  -*app/api/__init__.py*
  -*app/__init__.py*
  -*app/config.py*
  -*app/model/*
  -*test/*
  -*html/*
  -*_bootlocale.py*
  -*typing.py*

错误消息中的第 23 行在上面的文件中如下所示:

  - "examples/*

我应该怎么做才能纠正这个?

4

1 回答 1

1

该行的问题是它缺少右引号。但是,所有exclude_paths模式都需要用引号括起来;即配置应如下所示:

---
machine:
  environment:
    CODECLIMATE_REPO_TOKEN: ab24b326dac817e772c5246823b67af66e2358e51134c33e20aaf7fb228088b0

engines:
  duplication:
    enabled: false
    config:
      languages:
      - python
  fixme:
    enabled: true
  pep8:
    enabled: true
  radon:
    enabled: true
ratings:
  paths:
 - "**.py"
exclude_paths:
 - "docs/*"
 - "examples/*"
 - "*api/songs/models*"
 - "*/site-packages/*"
 - "*markupsafe/*"
 - "*psycopg2/*"
 - "*six.py*"
 - "*sqlalchemy/*"
 - "*werkzeug/*"
 - "*stringprep.py*"
 - "*uuid.py*"
 - "*ctypes/*"
 - "*decimal.py*"
 - "*encodings/*"
 - "*hmac.py*"
 - "*asyncio/*"
 - "*concurrent/*"
 - "*multiprocessing/*"
 - "*mimetypes.py*"
 - "*numbers.py*"
 - "*pydoc.py*"
 - "*http/*"
 - "*app/api/user/__init__.py*"
 - "*app/api/request/__init__.py*"
 - "*app/api/__init__.py*"
 - "*app/__init__.py*"
 - "*app/config.py*"
 - "*app/model/*"
 - "*test/*"
 - "*html/*"
 - "*_bootlocale.py*"
 - "*typing.py*"

注意:您仍然会看到一些弃用警告,因为您使用的是旧.codeclimate.yml格式。CodeClimate 文档中有关于从旧格式转换为版本 2 的信息:

https://docs.codeclimate.com/docs/advanced-configuration#section-analysis-configuration-versions

于 2018-07-02T14:12:58.380 回答