Static Analysis for Mobile Applications


Posted November 26, 2017 by zaidinbutt

iOS is the operating system on which maximum of Apple’s mobile devices like iPhone, iPad are run. It is written in C, C++, Objective-C, and Swift. To run flawlessly on each and every user’s device,
 
iOS is the operating system on which maximum of Apple’s mobile devices like iPhone, iPad are run. It is written in C, C++, Objective-C, and Swift. To run flawlessly on each and every user’s device, the code goes through rigorous analysis and testing. One such phase is iOS static code analysis.

Once a piece of code is written, before it can be tested, it goes through code review. iOS Code review or iOS static analysis checks whether the code is written as per the coding guidelines. The aim of such analysis is to find any errors in the code without running the code. It would mean going through each and every line of the code and looking for potential errors. This review is different from testing the code or dynamic analysis of the code. In testing, you find bugs by running the code. It is a black box. You put input values, run the code and check whether the output is the expected one or not. iOS static code analysis is more like a white box. It would point at the following:

Potentially problematic code from output point of view

Unused variables

Uncalled functions

Unreachable or redundant code

The best way to get your code reviewed or statically analyzed would be through co-developers or programmers. But, that is either time-consuming or quite expensive. The best resort would be then freely available iOS code review tools like the following:

Clang: Clang now comes built-in with the Xcode. Xcode is the freely available IDE for developing codes for iOS. Once, you have developed your code using Xcode you can analyze it using Clang. It points at potential memory leaks and code structure errors.

OCLint: It is a standalone tool that would point at highly complex code, long codes, bad practices and any possible bugs in the code.

Infer:It is an open source code tool that is still evolving. It points at possible memory leaks in the code, null pointers and other possible bugs.

SwiftLint: It is mainly for swift code analysis. It can be run from command line or through Xcode.

The major drawback of the tools is that they are limited by the set of rules that have been incorporated in them. The best way to achieve a good iOS static code analysis would be to get it done by a trained developer who understands the code as well as the tool.
-- END ---
Share Facebook Twitter
Print Friendly and PDF DisclaimerReport Abuse
Contact Email [email protected]
Issued By zaidinbutt
Website static code analysis
Country United States
Categories Technology
Tags static code analysis , unused variables , xcode
Last Updated November 26, 2017