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
6
votes
1 answer

uncrustify: newline before opening brace for function definitions

Using uncrustify 0.60 I set nl_fcall_brace=force expecting the following result: newline between function arguments and the opening brace of function body string toNsdName(const string& sid) { if (sid.empty()) { return ""; } …
VladT
  • 311
  • 1
  • 6
5
votes
1 answer

Is there a maximum indentation at once setting for Uncrustify?

I have a block of objective c code that looks like this [paths enumerateObjectsUsingBlock:^(NSString * path, NSUInteger idx, BOOL * stop) { BOOL isDir; if ([fm fileExistsAtPath:path isDirectory:&isDir]) { ...... } }]; However,…
Tony
  • 36,591
  • 10
  • 48
  • 83
5
votes
1 answer

Remove, or ignore whitespace missing after parentheses

I'm trying to configure Uncrustify to prettify some obj-c files. With a code like this: - (IBAction) blah:(id)sender { which is fine to me, I obtain this: - (IBAction) blah:(id) sender { which is not fine anymore. I tried setting…
Carlo
  • 1,686
  • 3
  • 29
  • 43
5
votes
2 answers

Uncrustify: Which switch or setting affects the { for @interface and @protocol?

I use Uncrustify to beautify my code: http://uncrustify.sourceforge.net/ What switch or setting affects the { for @interface and @protocol?
Marcus S. Zarra
  • 46,571
  • 9
  • 101
  • 182
5
votes
3 answers

How to use uncrustify with atom-beautify?

I've been looking at the atom-beautify site and example .jsbeauifyrc, .editorconfig, and uncrustify.cgf files. I've also reviewed the options for atom-beautify. I know I'm supposed to specify where the config file is located in the atom-beautify…
5
votes
2 answers

How do I force opening braces to share the previous code line?

Using the Uncrustify tool I would like to apply the 1TBS style, which places braces like this: if (x < 0) { printf("Negative"); } How do I do this? I can't seem to find the right options.
Jim Blackler
  • 22,946
  • 12
  • 85
  • 101
5
votes
1 answer

Format part of a file through uncrustify

I would like to format only a part of a sourcefile, like a function instead of the whole file. This is needed because i can't format the old source completle. Only the newly added functions or changes in functions should be auto formated through…
donkeysoft
  • 51
  • 2
5
votes
1 answer

Uncrustify: nested block indeting is wrong

I have this code: dispatch_async(dispatch_get_main_queue(), ^{ if (self.adAppearBlockIsAnimated) { [UIView animateWithDuration:kAnimationTime animations:^{ self.adAppearBlock(); }]; } }); Unfortunately,…
Michał Hernas
  • 406
  • 3
  • 12
5
votes
1 answer

uncrustify adds space between double-parenthesis (C/Objective-C)

I'm having a very peculiar issue with uncrustify (v0.60) that no option seems to affect. The issue only occurs when there are parenthesis enclosed within parenthesis: // from a C header file: #define BEGIN_STACK_MODIFY(L) int __index = lua_gettop(…
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
5
votes
1 answer

Uncrustify option to leave whitespace on blank lines

I'm trying to find the option that leaves whitespace on blank lines. Currently uncrustify will strip all trailing whitespace (good!), however I want to keep whitespace if it's on a blank line, because it's generally to the indent level. Is this a…
Ryan
  • 5,416
  • 1
  • 39
  • 36
5
votes
1 answer

uncrustify space after // in wrapped command line

I use uncrustify with following parameter: sp_cmt_cpp_start = force # Add space after opening '//' cmt_width = 78 Input: bi.dwSize = sizeof (bi); //Size of the structure itself, must be initialized…
MeJ
  • 1,088
  • 10
  • 18
5
votes
1 answer

Uncrustify ObjC newline after method

Is there a way with Uncrustify to add a new line between method declarations and the open brace, similar to nl_fcall_brace, but for ObjC methods? - (void)addPendingBuddyRequests:(NSArray *)requests { } vs. - (void)addPendingBuddyRequests:(NSArray…
David Beck
  • 10,099
  • 5
  • 51
  • 88
4
votes
2 answers

Blank line after curly brace in function with uncrustify

I have configured xcode to use Uncrustify to beautify the code. I modified the Uncrustify configuration file and the resulting code is almost as desired. One thing I don't like is the removal of a blank line between a closing curly brace and the…
CrossProduct
  • 133
  • 9
4
votes
0 answers

Uncrustify guarantee function arguments are aligned to opening parenthesis

In my current uncrustify configuration, if a function is called, most of the time the arguments are aligned to the opening parenthesis which is what I want. However, if the first argument is long such that the line width (code_width) is exceeded…
Gregory Kuhn
  • 1,627
  • 2
  • 22
  • 34
4
votes
1 answer

Uncrustify: initialization list: starts with comma

I would like to archive a following code structure automatically by Uncrustify: Class(int aArg1, int aArg2, int aArg3) : BaseClass(aArg1) , iMember1(aArg1) , iMember2(aArg2) { } I've tried Uncrustify version:…
iblis
  • 181
  • 2
  • 9
1
2
3
9 10