【问题标题】:CodeClimate Not reading configurationCodeClimate 不读取配置
【发布时间】:2021-12-28 14:45:32
【问题描述】:

在我的 react 项目中,代码质量检查器 CodeClimate,使用高级 configuration 只是停止一些愚蠢的代码质量因素/阈值,例如 50 行代码,:

Function `AutocompleteCombobox` has 50 lines of code (exceeds 25 allowed). Consider refactoring.

我在package.json 之外创建了.codeclimate.yml 并将其上传到repo(与分支DEV 上的CodeClimate 连接),遵循documentation

这是.yml 文件的示例:

version: "2"         # required to adjust maintainability checks

checks:
  argument-count:
    enabled: true
    config:
      threshold: 4
  complex-logic:
    enabled: true
    config:
      threshold: 4


问题是: CodeClimate 不会根据我的配置文件更改记录和指标!! 我通过.yml 文件更改了记录;但仍未在 CodeClimate 网站上更新?!!指标与默认值相同。

*** 提示:CodeClimate 网站设置与我们停止所有条件无关,除默认值外没有任何应用!而且我不想删除并重新添加回购,因为我会在增强过程中丢失我的跟踪记录。

【问题讨论】:

    标签: software-quality code-climate


    【解决方案1】:

    问题很简单,服务器生成文件名为.codeclimate.json,因为我通过网站编辑配置,但在我的仓库中,当我将配置从.yml 转换为@987654326 时,我创建了名为.codeclimate.yml 的文件@ 我覆盖了服务器上完美运行的那个。

    may配置示例.codeclimate.json:

        {
          "version": "2",
          "checks": {
            "argument-count": {
              "enabled": false,
              "config": {
                "threshold": 4
              }
            },
            "complex-logic": {
              "enabled": true,
              "config": {
                "threshold": 15
              }
            },
            "file-lines": {
              "enabled": false,
              "config": {
                "threshold": 250
              }
            },
            "method-complexity": {
              "enabled": true,
              "config": {
                "threshold": 15
              }
            },
            "method-count": {
              "enabled": false,
              "config": {
                "threshold": 20
              }
            },
            "method-lines": {
              "enabled": false,
              "config": {
                "threshold": 25
              }
            },
            "nested-control-flow": {
              "enabled": true,
              "config": {
                "threshold": 4
              }
            },
            "return-statements": {
              "enabled": true,
              "config": {
                "threshold": 4
              }
            },
            "similar-code": {
              "enabled": false,
              "config": {
                "threshold": null
              }
            },
            "identical-code": {
              "enabled": true,
              "config": {
                "threshold": null
              }
            }
          },
          "exclude_patterns": [
            "config/",
            "db/",
            "dist/",
            "features/",
            "**/node_modules/",
            "script/",
            "**/spec/",
            "**/test/",
            "**/tests/",
            "Tests/",
            "**/vendor/",
            "**/*_test.go",
            "**/*.d.ts"
          ]
        }
    

    如果您遇到同样的问题,可能是 CodeClimate 上的配置重复,您只需要使用一个文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-17
      • 2012-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多