【问题标题】:Failed to load codeclimate report, but report exists未能加载代码气候报告,但报告存在
【发布时间】:2021-06-05 21:18:15
【问题描述】:

在 gitlab 中,我有一个生成代码气候报告的管道,应该显示在 gitlab 小部件中。

报告已成功生成(我添加了cat code-quality.json,但我收到消息«Failed to load codeclimate report»。

当我检查 gitlab 页面的源代码时,我看到一个似乎包含问题代码的字符串:

window.gl.mrWidgetData = { … ,"codeclimate":{"head_path":"/needhelp/needhelp-web/-/jobs/123456789/artifacts/download?file_type=codequality\u0026proxy=true","base_path":"/needhelp/needhelp-web/-/jobs/987654321/artifacts/download?file_type=codequality\u0026proxy=true"},"…

当我复制/粘贴不带\u0026proxy=true 的网址栏中的路径时,文件已成功下载。

这里是生成文件的.gitlab-ci.yml 配置。

static analysis:
    stage: test
    interruptible: true
    image:
        name: $CI_QA_IMAGE
        entrypoint: [""]
    script:
        - composer install --prefer-dist --no-progress --classmap-authoritative --quiet
        - php bin/console --env=test cache:warmup
        - |
            ./vendor/bin/phpstan analyze -c phpstan.neon --no-progress --memory-limit 1G --error-format=gitlab > code-quality.json && phpstan_error=0 || phpstan_error=1
            if [[ -n $phpstan_error ]]; then
                echo -e '\e[103;1mphpstan detected errors.\e[0m'
                ls -lh code-quality.json
                cat code-quality.json
                ./vendor/bin/phpstan analyze -c phpstan.ci.neon --no-progress --memory-limit 1G
            else
                echo -e '\e[92;1mphpstan detected no error with levelmax configuration.\e[0m'
            fi
        - bin/console lint:twig --env=test
        - bin/console lint:container --env=test
        - bin/console lint:xliff translations/ --env=test
    artifacts:
        when: always
        reports:
            codequality: ./code-quality.json

你知道这段代码有什么问题吗?或者如果没问题,我应该去哪里解决这个问题?

【问题讨论】:

标签: gitlab gitlab-ci code-climate phpstan


【解决方案1】:

一个可能的原因是 gitlab 无法解析 code-quality.json 您可以使用一些工具来验证 json 格式,例如:http://json.parser.online.fr/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多