【问题标题】:Running Codeclimate locally在本地运行 Codeclimate
【发布时间】:2018-05-05 07:09:59
【问题描述】:

我尝试通过阅读 Codeclimate readme docs 通过 docker 安装 Codeclimate。

为了在本地测试 Codeclimate。我新建了一个文件夹,放了hello.php.codeclimate.yml

以下是我的hello.php

<?php 

echo("Hello");

以下是我的.codeclimate.yml

version: "2"
checks:
  argument-count:
    enabled: true
  complex-logic:
    enabled: true
  file-lines:
    enabled: true
  method-complexity:
    enabled: true
  method-count:
    enabled: true
  method-lines:
    enabled: true
  nested-control-flow:
    enabled: true
  return-statements:
    enabled: true
  similar-code:
    enabled: true
  identical-code:
    enabled: true

然后我通过我的终端像下面这样运行 codecliate

docker run \
  --interactive --tty --rm \
  --env CODECLIMATE_CODE="$PWD" \
  --volume "$PWD":/code \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /tmp/cc:/tmp/cc \
  codeclimate/codeclimate analyze

它显示为Starting analysis 并在等待很长时间后显示。我收到超时错误。

我的配置有问题吗?

【问题讨论】:

    标签: php code-climate code-climate-cli


    【解决方案1】:

    您正在运行的命令正在拉取名为 codeclimate/codeclimate-structurecodeclimate/codeclimate-duplication 的 docker 镜像,如果您使用 here,您会注意到它们的压缩量约为 2gb,因此需要很长时间才能运行该命令是可以理解的。
    您可以通过运行docker pull codeclimate/codeclimate-structuredocker pull codeclimate/codeclimate-duplication 提前拉取图像来扩展命令。

    我通过将 debug env var 添加到 docker run 命令 (-e CODECLIMATE_DEBUG=1) 中发现了这种情况,当 CLI 工具运行异常时,这通常会派上用场。

    另一件事代码气候支持,可以在这种情况下帮助您设置更高的超时阈值 - -e CONTAINER_TIMEOUT_SECONDS=1800

    所有这些信息都包含在您在问题中链接到的自述文件中。 希望这能解决您的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多