OCLint-iOS-OC項目幾種簡單使用

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.


圖片名稱

發佈了203 篇原創文章 · 獲贊 44 · 訪問量 49萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章