Using OCLint in Xcode

原文链接:http://docs.oclint.org/en/stable/guide/xcode.html#


非常详细的文章,能够在xcode中看到不规范代码提示,方便简洁,感谢作者。

Using OCLint in Xcode

This document shows one solution of using OCLint to analyze the code quality of a Xcode project.

Background

This idea was originally posted in this blog. We hope to share it with more developers, and hope to motivate more ideas.

Setting up Target

  • Add a new target in the project, and choose Aggregate as the template.
../_images/xcode_screenshot_1.png
  • Name the new target, here we simply call it “OCLint”, you could have more than one targets that focus on different aspects of the code analysis.
../_images/xcode_screenshot_2.png
  • Add a new build phase in the target we just created. Choose Add Run Script for the phase type.
../_images/xcode_screenshot_3.png
  • In the script editor, we could enter the script which does the real work. We can also modify the script from this very generic version and its folks. We may need to change the xcodebuild options to use a particular scheme or target. In addition, based on the discussions we had, we can decide whether to use clean and dry runfeatures.
  • For xctool users, the script can be largely simplified to something like this.
  • For xcpretty users, the script is also much simplier, check it out from this gist.
../_images/xcode_screenshot_4.png

Running Analysis

  • Choose the correct build scheme, here we choose OCLint.
../_images/xcode_screenshot_6.png
  • Click to build, or use the shortcut Command+B.
  • When the progress bar scrolls to the very right, the analysis is done, then we can check out the analysis results same as compile warnings.
../_images/xcode_screenshot_8.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值