Is there an Uncrustify config for Google's Objective-C style?
Asked Answered
F

2

14

Is there a config file for Uncrustify that will format Objective-C per Google's Objective-C style guide?

Example config files for Uncrustify look a bit daunting and I'm hoping that I won't need to build one from scratch...

Fogged answered 12/12, 2011 at 21:29 Comment(0)
F
7

I wanted to incorporate uncrustify into my automated builds but faced problems. I found an alternative that I'm happy with. The AppCode objective-C IDE from Jetbrains works as a supplemental IDE to Xcode.

It includes an excellent and highly configurable code formatting tool, among other things.

enter image description here

. . . to my knowledge you can't invoke this tool from the cmd-line, however I've just filed a feature request to do so.

If you prefer Uncrustify there's a GUI Tool that might help.

Ferreira answered 28/5, 2012 at 8:6 Comment(5)
Great find, it is much easier to see what will happen when the code gets re-formatted this way. The preview area (visible at the right in the screenshot) shows the effect of each option when checked or unchecked.Deciare
Since I answered that there's also uncrusifyX github.com/ryanmaxwell/UncrustifyXFerreira
It should be noted that while AppCode has reformatting capability, it doesn't have a 'Google Style' profile built in. I can't see any way of generic import/export of profiles. The default is also almost useless in that it does virtually nothing. You have to go in and make quite a few changes (lots of tedious experimentation) before you get much useful happening.Barny
You're right - I could see a save option, but nothing about importing. . I've raised a feature request with Jetbrains.Ferreira
I think the .idea/codeStyleSettings.xml file may be helpful here.Grahamgrahame
F
2

That config file seems daunting only in length... (I've seen much worse!) I don't know if it conforms to the Google style guide, but mmorris posted his .cfg in this answer: https://mcmap.net/q/377253/-how-to-set-xcode-plugin-for-code-auto-formatting-closed

You don't want to strictly conform to the Google style anyway... it only uses two character indentation! ;)

Footpace answered 15/3, 2012 at 21:27 Comment(1)
4 char indents are insane, especially for posting code on the web! 2 should more than suffice IMHO.Prae

© 2022 - 2024 — McMap. All rights reserved.