再试sonarqube
2018-05-27 本文已影响24人
十一岁的加重
很早之前研究过sonarqube,很多坑,尝试了很多次,一直没有成功,最近又想尝试了,很多事,只要一直惦记,一直努力,总有一天会顿悟。
下载最近版本

启动

打开网页

登录

不知道什么token





sonar-scanner \
-Dsonar.projectKey=what \
-Dsonar.sources=. \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=faf84da0d53d2e0a760004b943f1cf73499e6fde

开始配置下载的

将下载的文件展开到您选择的目录中。 我们将在下面的步骤中将它称为<install_directory>。
通过编辑<install_directory> /conf/sonar-scanner.properties更新全局设置以指向SonarQube服务器:
#----- Default SonarQube server
#sonar.host.url=[http://localhost:9000]
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner
# must be unique in a given SonarQube instance
sonar.projectKey=my:project
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=My project
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
加入我们的环境变量


怎么难你的环境变量加成功了
查看一下环境变量有没有你的加
查看环境变量
echo $PATH
终端运行一下你的命令

然后呢
配置下记得有个中文界面的


半天安装不了,直接去github下载的,然后放进了插件文件 夹
https://github.com/SonarQubeCommunity/sonar-l10n-zh/releases


重启
./sonar.sh restart
终于中文了

随便搞个名字再把上面的代码放在脚本里

然后就…………居然成功了,以前没有这么简单啊,我开始有点接受不了了,不行,明天得去公司重新这样操作下

问题1、objc的插件来自这里
https://github.com/iamlile/sonar_objectivec_swift

问题2、居然检查了pod里的代码

参考文章1:
https://testerhome.com/topics/13158
其脚本一直走不通,已回帖,期待解决
参考文章2:
https://yq.aliyun.com/articles/541761?spm=a2c41.11181499.0.0
自定义规则实践中

cd oclint-scripts
./make
然后
oclint-scripts/scaffoldRule JustTest -t ASTVisitor

修改自定义规则后,校验
./build/oclint-release/bin/oclint -report-type pmd -o test.xml 测试代码目录/测试文件.m