5 Jan 2013

The Story of How I "uncrustified" My (X)Code

Once upon a time I forgot to align braces and put indents for more code readability. So, how did I quickly tidy it up? Not manually ;)

I found Uncrustify, a source code beautifier for a lot of languages: C, C++, C#, Objective-C, D, Java, Pawn and VALA. It's a command line utility, for OS X users it's available via macports too. You can finely tune Uncrustify settings to your liking using a config file, mine is here

Then came the question: is there a way to use this wonderful utility in XCode 4?

And the happy answer is yes, there is! Thanks to these Automator-Services.

Here are two screenshots to taste the difference between 
the "intentionally messed" code before:



...and perfectly styled code after: