在gitlab中,我有一个生成代码气候报告的管道,应该显示在gitlab小部件中。
该报告已成功生成(我添加了cat code-quality.json,但我的消息是未能加载编解码器报告)。
当我检查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在url栏中复制/粘贴路径时,该文件将被成功下载。
这里是生成文件的.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你知道这个代码有什么问题吗?或者如果可以的话,我应该在哪里解决这个问题?
发布于 2021-12-30 00:27:16
一个可能的原因是gitlab无法解析code-quality.json,您可以使用一些工具来验证json格式,例如:http://json.parser.online.fr/
https://stackoverflow.com/questions/67854011
复制相似问题