Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can use the Xcode "Run Script" build phases to automate the code format if you really need it (with Uncrustify's --no-backup option).

I agree Xcode should have this feature by default, but speaking for Uncrustify - it is reliable and always produce consistent output format. Anyway, it also took me more than an hour to configure it :)



Actually running uncrustify isn't a problem - I intended to make a shell script. What I wanted to do and have just work (HN won't let me use a literal asterisk so I used STAR):

uncrustify --inplace STAR.h STAR.m

I ended up having to download configs, deal with differences between the versions of uncrustify and configs, work out how to do inplace, get confused when it did it sometimes and not others, go "holy cow" when git showed all these extra files appearing (uncrustify does some sort of hashing scheme to avoid processing files seen before), trying to work out which files I could get rid of, finding it had put reformatted output in files with different extensions, trying to figure out what had happened, finding out that it doesn't autodetect headers as objc etc. And suspecting it may have problems if directories/files have spaces in their names.

I know it can work. I just don't trust that it will always work.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: