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

What does "Force" do in Uncrustify?

Many of the options include the Force value option: Add or remove space between nested parens sp_paren_paren { Ignore, Add, Remove, Force } What does it mean? How is it different than Add?
Brandon O'Rourke
  • 24,165
  • 16
  • 57
  • 58
18
votes
1 answer

Can Uncrustify be prevented from modifying certain sections of code?

Uncrustify is great, and does an excellent job of tidying code. However, I have some C code within a file that I don't want Uncrustify to change. Is there any way I can prevent Uncrustify from touching this, maybe by putting specific tags in…
Basirk
  • 353
  • 2
  • 7
15
votes
2 answers

Can Uncrustify align colons in Objective-C method calls?

I am using uncrustify 0.52. When I run it against Objective-C files, it wants to convert method invocations like this: [NSApp beginSheet:startTimerDialog modalForWindow:nil modalDelegate:nil didEndSelector:nil contextInfo:nil]; to…
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
14
votes
2 answers

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

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...
a paid nerd
  • 30,702
  • 30
  • 134
  • 179
14
votes
3 answers

Using Uncrustify with VIM

In my vimrc I call Uncrustify by this command: %!uncrustify -l CPP -c D:\uncrustify\default.cfg After that on some code I get a Windows Fatal error: But when I call uncrustify on the same code in the console using the -f option, there is no…
user14416
  • 2,922
  • 5
  • 40
  • 67
11
votes
4 answers

ctags multi-line C function prototypes

Is there a way for ctags to handle multiline function prototypes in C? I've searched around and the --fields=+S is supposed to do multiline prototypes, but I can't get it to work: ctags -x --c-kinds=pf --fields=+S file file: int foo(int x, int…
pseudosudo
  • 1,962
  • 1
  • 19
  • 30
11
votes
2 answers

How to format source code with braces on new lines with blocks and Xcode?

Is there a way to make Xcode not reformat formatted code, or is there a tool like uncrustify that can format source code that uses blocks? With blocks in objective-c, code has become hard to read. One solution is to write out the block definition…
Olof_t
  • 766
  • 9
  • 22
10
votes
3 answers

Ensure coding-style during a git commit

Im my company i set-up a continuous integration test and i run the tests when someone push the code on the server. Now i want to check that the code match with the our basic coding rules, the first rule is "run mogrify on your code!" There is…
TheObjCGuy
  • 687
  • 6
  • 15
8
votes
1 answer

Uncrustify command for CUDA kernel

I would like to apply uncrustify (via beautify in the Atom editor and a config file) to CUDA code. However, I don't know how to tell uncrustify to recognize CUDA kernel calls which have the following structure: kernelName <<>>…
Thomas
  • 1,199
  • 1
  • 14
  • 29
7
votes
1 answer

Vim autocmd (save file, run code formatter, reload file)

I wish to integrate the source code formatter Uncrustify with Vim. Any of the below two options will suffice. Format the code that I am currently editing (i.e. when gq is pressed). Format the code when I save the file and then reload the formatted…
user1280213
  • 269
  • 3
  • 10
7
votes
1 answer

Using uncrustify without aligning under open parenthesis

I'm trying to configure uncrustify (a source code beautifier) to avoid aligning beneath a previous open parenthesis. For example, I'd like the code to look like this (from file indent_paren.c): void f(void) { while (one && two) { …
Michael Henry
  • 496
  • 3
  • 8
6
votes
1 answer

How to indent properly after java lambda expression with uncrustify formatter?

I am using atom with atom-beautify and uncrustify to format my java files. I want the indentation of a lambda expression to only indent one level after an open brace, () -> {. I have tried adjusting the indent_continue property, but it goes crazy…
David C
  • 1,898
  • 2
  • 16
  • 31
6
votes
1 answer

How to configure Uncrustify for Allman style for Swift iOS programming?

I'm trying to get a configuration for UncrustifyX that will work with Swift using the Allman Style. I'm using BBUncrustifyPlugin in Xcode. Here's what I have so far: # indent using tabs input_tab_size = 8 output_tab_size …
Bryan Cimo
  • 1,268
  • 1
  • 19
  • 34
6
votes
1 answer

Why is Uncrustify forcing a space before my Objective-C block closing brace?

I'm having problems with my -rather extense- Uncrustify Configuration. I'm using Xcode to auto-run Uncrustify. For some reason, Uncrustify seems to add a Space before the closing Brace of a block declaration. Sample Input [_collectionView…
Goles
  • 11,599
  • 22
  • 79
  • 140
6
votes
2 answers

Adding braces for If-else using Uncrustify

I was wondering if there is any way to add braces in nested If-else using Uncrustify. For example: if( stat_error == -1 ){ if ( debug > 0 ) printf( "...ERROR ); //I would like to add braces around here. exit( -1 ); } else { I have seen…
Cod1ngFree
  • 1,873
  • 6
  • 21
  • 33
1
2 3
9 10