IOS测试之sonar检查ios代码质量
来源:互联网 发布:淘宝自动刷单软件 编辑:程序博客网 时间:2024/06/05 20:22
参考信息:sonar-objective-c
ios项目
我提供了一个sample的项目,首先git clone该项目到本地。
git clone https://github.com/DoctorQ/ios_test.gitCloning into 'ios_test'...remote: Counting objects: 88, done.remote: Total 88 (delta 0), reused 0 (delta 0), pack-reused 87Unpacking objects: 100% (88/88), done.Checking connectivity... done.
安装OCLint
因为sonar-objective-c使用的是OCLint来扫描代码的,所以需要安装OCLint,使用下面的命令来安装 (前提是你有brew工具)。
brew install https://gist.githubusercontent.com/TonyAnhTran/e1522b93853c5a456b74/raw/157549c7a77261e906fb88bc5606afd8bd727a73/ocli nt.rb
安装sonar
看我另外两篇关于sonar的安装使用。
- sonarQube
- sonarRunner
其他工具安装
安装XCtool
详细安装方法参考官网
brew install xctool
安装gcovr
详细安装方法参考官网
brew install gcovr
xcode安装
直接app store上安装xcode最新版
添加sonar-objective-c文件
文件添加
如果想要分析代码,需要在待分析项目根目录下添加2个文件:
- run-sonar.sh
- sonar-project.properties
文件修改
sonar-project.properties文件中修改一些配置信息。详细的配置说明我已经写在各个脚本的注释上了:
########################### Required configuration ############################sonar服务器上的访问地址后缀,比如我们可以设置下面的属性为ios,就可以通过http://server:port/dashboard/index/ios来访问该项目的数据sonar.projectKey=ios#项目的名称sonar.projectName=ios#版本号sonar.projectVersion=1.0sonar.language=objc# Project descriptionsonar.projectDescription=test for sonar-objective-c# 要检测的源码的目录sonar.sources=0403_test# 要检测的测试源码目录,如果没有注释掉即可# sonar.tests=testSrcDir# Xcode project configuration (.xcodeproj or .xcworkspace)# -> If you have a project: configure only sonar.objectivec.project# -> If you have a workspace: configure sonar.objectivec.workspace and sonar.objectivec.project# and use the later to specify which project(s) to include in the analysis (comma separated list)#项目根目录下的xcodeproj的名称sonar.objectivec.project=0403_test.xcodeproj # sonar.objectivec.workspace=myApplication.xcworkspace# 应用的scheme信息,如果不知道没关系,先执行该脚本,它会提示你当前项目的scheme信息sonar.objectivec.appScheme=0403_test# 同上,只是用于测试,如果没有就直接注释掉# sonar.objectivec.testScheme=myApplicationTests########################### Optional configuration ############################ Encoding of the source codesonar.sourceEncoding=UTF-8# JUnit report generated by run-sonar.sh is stored in sonar-reports/TEST-report.xml# Change it only if you generate the file on your own# The XML files have to be prefixed by TEST- otherwise they are not processed # sonar.junit.reportsPath=sonar-reports/# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml# Change it only if you generate the file on your own# sonar.objectivec.coverage.reportPattern=sonar-reports/coverage*.xml# OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml# Change it only if you generate the file on your own# sonar.objectivec.oclint.report=sonar-reports/oclint.xml# Paths to exclude from coverage report (tests, 3rd party libraries etc.)# sonar.objectivec.excludedPathsFromCoverage=pattern1,pattern2sonar.objectivec.excludedPathsFromCoverage=.*Tests.*# Project SCM settings# sonar.scm.enabled=true# sonar.scm.url=scm:git:https://...
执行sonar检测
命令行定位到项目根目录下,执行sh run-sonar.sh命令
sh run-sonar.shRunning run-sonar.sh...-n Extracting Xcode project information-n .-n .Skipping tests as no test scheme has been provided!-n Running OCLint...-n Running SonarQube using SonarQube Runner-n .-n .-n .-n .-n .-n .-n .-n .-n .-n .-n .-n .-n .-n .-n .-n .-n .-n .-n .
执行成功后,查看结果如下:
DONE!
0 0
- IOS测试之sonar检查ios代码质量
- IOS-Sonar代码质量监控
- 代码质量检查工具Sonar结合hudson、maven使用
- 【Sonar代码质量检测工具】
- sonar代码质量分析
- Sonar代码质量检测工具
- sonar代码检查
- sonar代码检查工具
- sonar代码检查
- iOS使用sonar进行代码分析
- 提高代码质量之静态代码检查
- 代码管理:iOS高质量代码之耦合的处理
- sonar 代码检查规则设定
- 编写高质量iOS代码
- Sonar + IOS 安装失败。
- Jenkins+Gitlab+Sonar代码检查平台搭建-Sonar
- sonar监控java代码质量使用说明
- Java代码质量监控工具Sonar安装
- Python中self的理解
- 第十节 常用组件 之 Lookup 创建查找转换
- ExtJs通过后台动态创建树
- 小户型特色涂鸦装饰 55平时尚三口之家
- iOS帐号、证书之漫谈(三)—— 申请Apple ID
- IOS测试之sonar检查ios代码质量
- [Unity3D]Unity中的Time
- mongodb 的一些常用命令。
- 第五题(重写,重载)
- java web开发 高并发处理
- android横屏竖屏切换时发生的事情
- 第四题(String的split方法)
- RFID第三次作业第三题
- Codeforces 536A Tavas and Karafs 二分+结论