在进行静态代码扫描之前需要对项目进行配置,在项目目录下创建sonar-project.properties文件,以我这里分析的Golang项目为例

# must be unique in a given SonarQube instance
sonar.projectKey=play-golang

# --- optional properties ---

# defaults to project key
sonar.projectName=play-golang
# 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
sonar-scanner

参考: