php - SonarCloud 分支没有代码行 - bitbucket 管道 - sonarsource/sonarcloud-scan
问题描述
我正在尝试将 sonarcloud 与 Bitbucket 管道集成。我有一个简单的测试项目,其中包含几行名为 index.php 的单个文件。
我完全不确定我应该遵循什么方法。
我创建了包含以下几行的 sonar-project.properties 文件。
sonar.sourceEncoding=UTF-8
sonar.host.url=https://sonarcloud.io/dashboard?id=first_ftp
sonar.projectKey=first_ftp
这是我的 yml 文件
image: aariacarterweir/lamp-gitftp:latest
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- node
- sonar
script:
- npm install --quiet
- npm run test -- --code-coverage --no-watch --no-progress --browsers=ChromeHeadlessNoSandbox
- pipe: sonarsource/sonarcloud-scan:0.1.5
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
EXTRA_ARGS: '-Dsonar.sources=src -Dsonar.tests=src -Dsonar.test.inclusions="**/testing/**,**/*.spec.ts" -Dsonar.typescript.lcov.reportPaths=coverage/lcov.info'
当我查看 sonarcloud 网站时,它告诉
The main branch has no lines of code
任何人都可以帮助我如何使用 bitbucket 为 php 项目正确配置 sonarcloud。
解决方案
我遇到了同样的问题——在我的情况下是因为项目的名称——它被称为---------Test
,显然,默认情况下,Sonar 会将其视为测试程序集并将其排除在分析之外。
推荐阅读
- python - flask-socketio 服务器和 python-socketio 之间的安全通信
- python - 是否需要在其他文件中导入相同的模块?
- c# - 棱镜。关闭使用 IDialogService 创建的对话框
- amazon-web-services - Sam local Invoke lambda 与本地层错误“无法导入包”
- ios - 如何以编程方式在 WKWebView 滚动视图上向下滚动
- python - TensorFlow 对象检测 API 评估训练性能
- c# - ILMerge 或 ILRepack 将程序集引用添加到 dll
- azure - Spark 将检索到的数据保存在 Azure Databricks 的什么位置?
- sql - 使用多个 go 语句时如何创建 SQL 视图?
- r - 递归条件累积积