问题描述
今天,我安装了sonarqube和sonarqube运行程序来扫描我的PHP项目。但是运行扫描程序后,它显示该项目的主分支为空。。
sonar-scanner.properties
#Configure here general @R_25_4045@ion about the environment,such as SonarQube server connection details for example
#No @R_25_4045@ion about specific project should appear here
#----- Default SonarQube server
#sonar.host.url=http://localhost:9000
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8
sonar.projectKey=raka
# --- optional properties ---
# defaults to project key
#sonar.projectName=My project
# defaults to 'not provided'
#sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Defaults to .
#sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
谁能告诉我我做错了什么?请帮助我是PHP新手
解决方法
发生此错误的原因是,由于在 sonar-scanner.properties 中您已注释掉分析属性sonar.sources=.
Sonarqube需要扫描源文件才能显示Sonar扫描结果。如果没有要分析的源文件,则会抛出此错误:该项目的主分支为空。
sonar-scanner.properties 文件中的更改
#Configure here general information about the environment,such as SonarQube server connection details for example
#No information about specific project should appear here
#----- Default SonarQube server
#sonar.host.url=http://localhost:9000
#----- Default source code encoding
sonar.sourceEncoding=UTF-8
sonar.projectKey=raka
# --- optional properties ---
# defaults to project key
#sonar.projectName=My project
# defaults to 'not provided'
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Defaults to .
sonar.sources=.
,
就我而言,我更改了代码所用语言的文件后缀。
sonar.ruby.file.suffixes = .rbt
之前是 .rb,为了一些测试改变了它,忘记恢复了。