While developing for iOS one of tools that I missed a lot from my C# projects  was FxCop. FxCop was a tool that analysed your assemblies and reports information about the assemblies, such as possible design, localization, performance, and security improvements.  On Xcode the only similar tools is the static analyser but it’s scope its limited to memory issues.

So it was with great excitment  that I found out about the OCLint project. As they say in their website

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

  • Possible bugs – empty if/else/try/catch/finally statements
  • Unused code – unused local variables and parameters
  • Complicated code – high cyclomatic complexity, NPath complexity and high NCSS
  • Redundant code – redundant if statement and useless parentheses
  • Code smells – long method and long parameter list
  • Bad practices – inverted logic and parameter reassignment

The documentation is excellent and it’s very simple to integrate it to Xcode or better yet to your Jenkins build server ( just missing a easy way to use it on Travis CI easily can someone provide a brew for it?).

My selected approach was using it with xctool but I need to tweak a bit the default values :(20 characters for a objective C variable name is a bit on the short side). Here is the script that I’m using at the moment for Xcode

For Jenkins I’m using this variation that allows to create PMD reports





%d bloggers like this: