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
3
votes
0 answers

How to indent c++ template declaration in Qt

I am using Qt with uncrustify c++ code beautifier plugin. I want to give indentation after the template declaration as given below template void f(){} and not: template void f(){} I have tried but couldn't find a…
jeff
  • 684
  • 1
  • 11
  • 30
3
votes
2 answers

Fix uncrustify formatting for lambda expression

I would like to homogenize Qt Creator and uncrustify formatting for lambda expression. Writing the following code with Qt Creator produces the following format: connect(this, &MyObject::mySignal, [&] { qDebug() << "test lambda uncrustify…
Martin Delille
  • 11,360
  • 15
  • 65
  • 132
3
votes
2 answers

which Uncrustify setting replaces blank lines with indenting spaces?

I've done a number of read-thrus of my Uncrustify settings page over the past couple days but haven't found the setting. Perhaps a second pair of eyes knows what I am missing. In my source code, the blank lines within functions are getting…
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
3
votes
1 answer

Format constructor member initialization with Uncrustify

I'm using uncrustify 0.56 and I'd like to know if it's possible to format constructors like that: MyClass::MyClass(int arg1, int arg2, int arg3) : m_arg1(arg1), m_arg2(arg2), m_arg3(arg3) {} // shall be formatted to MyClass::MyClass(int arg1, int…
janr
  • 3,664
  • 3
  • 24
  • 36
3
votes
2 answers

Uncrustify Collapse Multiline Function Call

I have function calls that look like this (for no apparent reason): func ( a, b, c ) Is there a way to make uncrustify collapse the function into a single line? I have been trying for two days not on and off... I got it to work for…
rioki
  • 5,988
  • 5
  • 32
  • 55
3
votes
1 answer

Align on colons in Objective-C headers

I want to use uncrustify to align my parameters on colon, and have some limited success. Using the information in Can Uncrustify align colons in Objective-C method calls? I have the following in my config file: align_oc_decl_colon =…
Pål Brattberg
  • 4,568
  • 29
  • 40
2
votes
1 answer

How to add a new line before #pragma mark using uncrustify?

Is it possible to have uncrustify add some empty lines before/after the #pragma mark - directives? If that is important, I am referring to Xcode 4.2 and iOS development in objC. [EDIT] What I mean is something like the following: // Some code here,…
phi
  • 10,634
  • 6
  • 53
  • 88
2
votes
2 answers

How to align function declaration using uncrustify?

I'm trying to replicate the GNU coding standard using uncrustify. My program has the following function declarations, static void connect_to_server_cb1 (GObject *source_object, GAsyncResult *result, …
vishnumotghare
  • 591
  • 1
  • 5
  • 23
2
votes
1 answer

uncrustify: How do I set the maximum line length

After running uncrustify I want no line to be longer than, say, 80 characters. How do I set the maximum length of a line in the uncrustify config file?
klpskp
  • 21
  • 3
2
votes
2 answers

How to configure uncrustify in visual code?

I've installed uncrustify in my linux machine and installed it's the extension in Visual Code as well. I've configured the settings.json as follows: "uncrustify.executablePath": "/usr/bin/uncrustify", "uncrustify.configPath":…
Rinaldi Segecin
  • 449
  • 8
  • 23
2
votes
0 answers

Uncrustify options indent_ctor_init and indent_ctor_init_leading seems not to work

I want to intend the constructor initializer list using: Virtual indent from the ':' for member initializers. Default is 2 indent_ctor_init_leading = 2 Additional indenting for constructor initializer list indent_ctor_init …
mtb
  • 1,350
  • 16
  • 32
2
votes
1 answer

Uncrustify align trailing comments?

Is there a way to go from the below int a; ///< This is a variable int b = 3; ///< This is another variable To the below? int a; ///< This is a variable int b = 3; ///< This is another variable
Ayberk Özgür
  • 4,986
  • 4
  • 38
  • 58
2
votes
0 answers

Uncrustify first line break after first message

I'm using uncrustify to format my objc code and it is currently formatting a method call like this, where it's putting the first newline after the object, and instead I want the first new line to be after the first message.…
Idr
  • 6,000
  • 6
  • 34
  • 49
2
votes
2 answers

Uncrustify: Remove double and more empty lines in ObjC code

So basically I have such code: NSString *const SomeKey = @"SomeKey"; @implementation SomeClass - (void)doSomeWork { [self startDoingSomeWork]; [self stopDoingSomeWork]; [self notifySomeWorkDone]; } I need this code to be…
Vlad Papko
  • 13,184
  • 4
  • 41
  • 57
2
votes
1 answer

Uncrustify: remove space opening/closing a block

How can I clean up blocks like the following: if(a) { foo(); } into if(a) { foo(); }
Sam
  • 19,708
  • 4
  • 59
  • 82