Questions tagged [uncrustify]

Source Code Beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and VALA

Uncrustify is an open source project, with a goal to create a highly configurable, easily modifiable source code beautifier.

Features :

  • Ident code, aligning on parens, assignments, etc
  • Align on '=' and variable definitions
  • Align structure initializers
  • Align #define stuff
  • Align backslash-newline stuff
  • Reformat comments (a little bit)
  • Fix inter-character spacing
  • Add or remove parens on return statements
  • Add or remove braces on single-statement if/do/while/for statements
  • Supports embedded SQL 'EXEC SQL' stuff
  • Highly configurable - 515 configurable options as of version 0.63
144 questions
2
votes
0 answers

How to prevent indentation of @ access specifiers?

In a class declaration like this: @interface MyView : NSView { @private id observedObject; } @end when I run uncrustify on it the @private specifier is indented even though I'd like to keep it in its default column. Which uncrustify option…
Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
2
votes
0 answers

Exactly one line after @implementation and @interface with Uncrustify on Objective-C?

After the Uncrustify pass, I would like this code block: @implementation MyClass - (instancetype)init { self = [super init]; if (self) { } return self; } To look like: @implementation VICameraOverlayViewController -…
Goles
  • 11,599
  • 22
  • 79
  • 140
2
votes
0 answers

Uncrustify vs. Objective-C: method colon alignment

I'm trying to get Uncrustify to work for me with Objective-C code. Ordinarily, I'd like multi-line method signature declaration/implementations to be colon-aligned, like - (void)doSomethingWithThis:(id)this that:(id)that …
Clay Bridges
  • 11,602
  • 10
  • 68
  • 118
2
votes
0 answers

Uncrustify for c++ adds closed parenthesis after comma templated parameters

I have the following function: template bool checkSomething( param1, param2, param3) {...} when I put the following function call through Uncrustify: if( somethingChanged == checkSomething( param1,…
Oksana K
  • 155
  • 2
  • 9
2
votes
1 answer

Uncrustify: Space between function name and brace at end of line

If I have a function like this: - (id)init { self = [super init]; if(self){ } return self; } and I want uncrustify to output this: - (id)init{ self = [super init]; if(self){ } return self; } What options would I…
Cory Imdieke
  • 14,140
  • 8
  • 36
  • 46
1
vote
0 answers

Uncrustify function pointer spacing after star

I'm trying to configure uncrustify to beautify the following example: void *( * functionptr1)(int x, void * ptr); char*(*functionptr2)(int x, void* ptr); char * ( *functionptr3)(int x, void *ptr); So that it becomes like this: void*…
fnadeau
  • 11
  • 1
1
vote
0 answers

Uncrustify - trailing comment inside an enum

Is there a way to configure Uncrustify so trailing comments inside an enum won't be automatically moved to a new line? Meaning, I wish that if I write the following: enum Foo { ITEM1, // this is item 1 ITEM2, // this is item 2 ITEM3 //…
sob
  • 21
  • 2
1
vote
0 answers

How can I configure uncrustify to force one space after "struct"?

How can I configure uncrustify to change this: struct point { int x; int y; }; into this?: struct point { int x; int y; }; Notice that the extra spaces between struct and point are removed. I have spent a lot of time reading…
Dave
  • 885
  • 2
  • 10
  • 20
1
vote
1 answer

uncrustify: how to combine arguments of multiline C function call on to a single line?

I am using uncrustify 0.69.0 (I can't get 0.71.0 to compile yet). I have the following: sendto(cmd_sock, buf, strlen(buf), 0, (struct sockaddr *)&fromCmd, sizeof(struct sockaddr_in)); And I want uncrustify to combine…
oldunixguy
  • 31
  • 3
1
vote
0 answers

uncrustify: how to force a trailing { after an else

I am running uncrustify version 0.69 on Ubuntu 12.04 I want this output if () { } else { } This mostly happens but I cannot get a forced trailing { on a naked else. With this if () { } else statement; It does NOT change it to this if () { }…
oldunixguy
  • 31
  • 3
1
vote
0 answers

Uncrustify config options for block after return formatting

What config settings can I make of use of to make uncrustify format like the the expected output for ObjC++ code. Input: SomeObject *buildObject() { return BuildObject(^(CKComponent *) { [[[Object alloc] initWithLogger:[Logger new] …
KSC
  • 406
  • 1
  • 6
  • 8
1
vote
1 answer

C++ / Uncrustify / Indenting base class specifications

How do I setup uncrustify so that this code: static const class Example : Int1 , Int2 , Int3 looks like this: static const class Example : Int1 , Int2 , Int3 I can not find any option which does only indent the derived classes.
Markus
  • 11
  • 1
1
vote
0 answers

uncrustify: function definition argument indenting on separate line

I have this: char * foo(a,b) int a; int b; { ... } I want this: char * foo(a,b) int a;// indented int b;// indented { ... } The indenting works for function body code but I cannot find an option to make this style of argument (old style…
oldunixguy
  • 31
  • 3
1
vote
0 answers

Uncrustify space after opening c comment

I'm trying to find an option in Uncrustify that does nearly what sp_cmt_cpp_start does for C++ comments but for c. Specifically, what I would like is to change this comment: /*some comment*/ to this: /* some comment */ Is there an option for…
Gregory Kuhn
  • 1,627
  • 2
  • 22
  • 34
1
vote
1 answer

Uncrustify spacing issue with macro inside method call

I am attempting to use Uncrustify on a project of mine, but I am running into some issues with spacing changes that it makes when a macro is used as the receiver of an Objective-C message. For example, given the following macro and method call, I…
Bryan Henry
  • 8,348
  • 3
  • 34
  • 30