OCLint-iOS-OC项目几种简单使用

来源:互联网 发布:手机淘宝开店不成功 编辑:程序博客网 时间:2024/05/18 09:00

OCLint-iOS-OC项目几种简单使用

未完待续

- - OCLint-iOS-OC项目几种简单使用 OCLint的部分规则(Basic 部分) OCLint的部分规则(Unuseed 部分) OCLint的部分规则(Size 部分) OCLint的部分规则(Redundant 部分) OCLint的部分规则(Naming 部分) OCLint的部分规则(Migration 部分) OCLint的部分规则(Empty 部分) OCLint的部分规则(Design 部分) OCLint的部分规则(Convention 部分) OCLint的部分规则(CoCoa 部分)



OCLint简介

OCLint is a static code analysis tool for improving quality and reducing defects by inspecting C, C++ and Objective-C code and looking for potential problems like possible bugs, unused code, complicated code, redundant code, code smells, bad practices, and so on.

安装

$ brew tap oclint/formulae

$ brew install oclint

Using OCLint with xcodebuild

xcodebuild -target DemoProject -configuration Debug -scheme DemoProject

Using OCLint with xctool

安装

$ brew install xctool –HEAD

xctool -reporter json-compilation-database:compile_commands.json build

Using OCLint with xcpretty

安装

$ brew install xcpretty

xcodebuild [flags] | xcpretty -r json-compilation-database -o compile_commands.json

Using OCLint in Xcode

  • Add a new target in the project, and choose Aggregate as the template.


    图片名称

  • 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.


图片名称

  • Add a new build phase in the target we just created. Choose Add Run Script for the phase type.


图片名称

  • Choose the correct build scheme, here we choose OCLint.Click to build, or use the shortcut Command+B.
  • 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.


图片名称

原创粉丝点击