Code linting for Objective C

て烟熏妆下的殇ゞ 提交于 2019-12-18 10:46:06

问题


Are there any code linting tools for ObjectiveC?


回答1:


Have a look at the LLVM/Clang Static Analyzer

The LLVM/Clang static analyzer is a standalone tool that find bugs in C and Objective-C programs and it is very early in development.

A static analyzer based on clang. The goal of the Clang project is to create a new C, C++, Objective C and Objective C++ front-end for the LLVM compiler.

Edit

Clang has now been integrated into Xcode and can easily be run as a menu option "Build & Analyse"




回答2:


It's worth mentioning OCLint too. It covers some things not touched by the Clang analyser, such as:

  • Complicated code - high cyclomatic complexity and NPath complexity
  • Code smells - long method, long parameter list, redundant code

Check out the home page for more details.




回答3:


I know it is an old question, but I will add another one static analysis tool here for the sake of completeness, Infer, from Facebook

You can see their home page, works with iOS and Android projects, and spare Obj-C/Java/C files




回答4:


There is also the commercial tool FauxPas, which catches a lot of code smells, but also stuff like unused graphics, translation format argument mismatch, etc.

It’s not super cheap, but I‘m a happy user. There's a time-limited trial version available, which is fully functional, as far as I know.




回答5:


For simple syntax stuff like enforcing number of line breaks, sorting imports, etc., also have a look at Clang Format. The easiest way to install is probably via Homebrew.



来源:https://stackoverflow.com/questions/563225/code-linting-for-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!