Objective-Clean
Objective-Clean is an app which helps facilitate automatically checking style in Objective-C. When set up properly with the Vokal style files, this app will give you warnings for various style inconsistencies.
We have a site license available for Objective-Clean. Use is therefore strongly encouraged.
Download the trial version of Objective-Clean from the website. Upon running the app successfully, a dialog box will appear in which you can enter our license information.
Note that the style files do not cover all of our code standards, as Objective-Clean only covers certain formatting options. You and your code reviewer are still responsible for keeping an eye out for anything the app might have missed. It is, however, a great way to keep from getting "Hey, you missed a bracket on the wrong line" comments in code review.
Initial Setup
If nobody on your project has already set up Objective-Clean the steps to do so are pretty simple. Here are the steps:
Instructions
- Drop the Vokal Objective-Clean style file into the same folder as your
.xcodeproj
file. - Fire up the Objective-Clean desktop app. The app must be in your Applications folder rather than Downloads. Receiving a script warning after running your Xcode project is an indication that the app is in the wrong folder.
- Drag and drop the
.xcodeproj
file into the desktop app's "Add a project" window. - If you're using any third-party libraries not through CocoaPods (which are ignored by default), add your
Libs
folder to the comma-separated list of folders which should be ignored, so you only get warnings about your own poorly-formatted code instead of third party poorly-formatted code. - If you're using MOGenerator, Cat2Cat, or any other automatic code generation tool, make sure you add the machine-generated files folder to the ignore list for the same reasons.
- Hit the Install Run Script button.
- The first time you build locally after installing the script, you'll get a dialog asking for confirmation of which folder to scan (due to sandboxing restrictions). Confirm, and then you're off to the races.
Make sure you commit your Style Settings file with the project so all members of a team are getting warnings based on the same style.
Ignoring Specific Lines
Note that if you ever need to have Objective-Clean skip a part of your file because you're breaking the rules for a good reason, you can force it to skip with a specially formatted comment:
//##OBJCLEAN_SKIP##
//The code you want to ignore
//##OBJCLEAN_ENDSKIP##
If you want to prevent Objective-Clean from throwing a warning when it runs on a computer without the appropriate app installed, update the warning line which is added by the app to instead just echo the following: echo "NOTE: You have to install and set up [app name] to use its features!"
More documentation is available at the Objective-Clean site
Vokal Limitations
- We have not set up Objective-Clean on our CI server - the warnings this tool generates will not wind up as part of your automated test coverage.
- Remember: This only covers a subset of our code standards. You are still responsible for following any standards not covered by the style file.