A Style-Checking Tool for Objective-C
Azoft Blog A Style-Checking Tool for Objective-C

A Style-Checking Tool for Objective-C

By Alexey Minaev on October 16, 2014

style checking tool for objective c

As large-scale projects involving many programmers often produce code that is inconsistent in style, our team searched for a tool to use with Objective-C that checks for adherence to agreed-upon stylistic guidelines, including the use of braces, paragraph formatting, comment formatting and the declaration of variables. Recently, we have found OcStyle developed by Cue, a productive style checker for use with Objective-C.

What the tool lacked was the support for Jenkins CheckStyle format, so we wrote ObjcCheckStyle. In this extension, we customized ocstyle for our needs and integrated it with Jenkins. Now it generates *.xml reports that can be further analyzed by the Jenkins CheckStyle plugin.

This ObjcCheckStyle extension is available on GitHub, and we invite you to feel free to use it. Pull requests are welcome as always.

Note: Not all features of Objective-C are supported on our tool.

How to install

pip install objccheckstyle

How to customize

You can customize the following parameters when running our tool:

  • xmlLogFolderPath – A required parameter. To let the Jenkins CheckStyle plugin find the generated reports, you need to set a project’s root folder as the default Log Folder.
  • maxLineLength – Optional. ‘120’ by default.
  • excludedDirs – Optional. ‘None’ by default. For example 3d party libs dirs. csv.
  • checkstyleResultFilename – Optional. ‘checkstyle-result.xml’ by default.

How it works

As an illustration, you’ll find two files below with style errors, and here (link to download checkstyle-result.xml) is the report that identifies those errors.

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
A Style-Checking Tool for Objective-C, 5.0 out of 5 based on 1 rating

Request a Free Quote

Please enter the result and submit the form

Content created by Alexey Minaev