Are there any code linting tools for ObjectiveC?
5 Answers
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"
-
1The above link is 404'ed, for finding information about Clang / LLVM static analysis, I recommend reading [this](https://clang.llvm.org/docs/UsersManual.html#controlling-static-analyzer-diagnostics) and then `jmp` to [this](https://clang-analyzer.llvm.org/) – ipatch May 31 '18 at 19:46
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.

- 16,959
- 6
- 53
- 76
-
1is there any tutorials for OCLint? I can't find anything better than oclint --help. – clopez Nov 15 '12 at 15:27
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.

- 9,842
- 3
- 37
- 57
-
Is it OK to link to commercial tools? I’ve omitted the link both because I’m on mobile and because I’m not sure. – fzwo Mar 19 '18 at 11:32
-
2
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.

- 9,842
- 3
- 37
- 57