Bootstrap

python-sonar

sonar如何安装网上很多,不写了。

本地sonar安装完成后,修改配置文件:

#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=https://sonar.xxxxx.com/

#----- Default source code encoding
sonar.sourceEncoding=UTF-8

#----- Global database settings (not used for SonarQube 5.2+)
sonar.jdbc.username=sonar
sonar.jdbc.password=xxxxxxxxx

sonar.login=qa-admin
sonar.password=xxxxxxxx

#----- MySQL
sonar.jdbc.url=jdbc:mysql://yourIP:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false

被测项目路径下,新增配置文件:sonar-project.properties,内容如下:

sonar.projectKey=TH_QAPF
sonar.projectName=TH_QAPF
sonar.projectVersion=1.0
sonar.sources=.
sonar.language=py
sonar.sourceEncoding=UTF-8
sonar.scm.disabled=true

配置文件已python为例

被测项目根目录,也就是sonar-project.properties文件所在路径下,打开cmd,输入sonar-scanner,执行。

出现上图内容为成功

;