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
1
vote
0 answers

Simulate indentation with uncrustify

I'm writing a simple git hook to ensure that all the committed code is corrected indented. We use uncrustify to indent our code and the this the script we run before every commit find -name "*.[hm]" -exec uncrustify -c uncrustify.cfg {} --replace…
TheObjCGuy
  • 687
  • 6
  • 15
1
vote
0 answers

Can I get Uncrustify to fix this newline issue?

Is there a way to get Uncrustify to remove the newline and whitespace in this if statement? I can't seem to find an option that fixes this sort of "issue". if (a == 5) { puts("a is five"); }
1
vote
1 answer

Uncrustify to always remove space between type and * or &

I want Uncrustify to generate this no matter what: TCHAR* p; So that all of the following (if any) are converted to the above: TCHAR * p; TCHAR *p; I also want: TCHAR* f( TCHAR* p ) And I don't want: TCHAR * f( TCHAR * p ) TCHAR *f( TCHAR *p…
user1908746
1
vote
1 answer

Uncrustify to align cascaded "if conditions"

the combination of UniversalIndentGUI and Uncrustify works for me very fine and saves me lots of time to format the C source codes. But I have a small extra question and want to know whether someone can help. Is it possible to correct the combined…
OISS
  • 97
  • 10
1
vote
1 answer

Uncrustify: Trim linebreaks before braces

What is the right config for uncrustify so that it removes empty lines before curly braces so that: } } else { // foo } [bar tend]; } becomes: } } else { // foo } [bar…
Adriaan Tijsseling
  • 2,025
  • 1
  • 18
  • 23
1
vote
1 answer

Uncrustify doesn't support for the new Objective-C syntax of LLVM 4.0

I have used Uncrustify for formatting code. But Uncrustify doesn't support for the new Objective-C syntax of LLVM 4.0. What am I going to do? The Code formated by Uncrustify: @interface SJTLLVM4Tester() @property (strong) NSNumber…
jqgsninimo
  • 6,562
  • 1
  • 36
  • 30
0
votes
0 answers

Uncrustify keeps adding spaces for aligning braces over and over

I'm running into issues with my uncrustify cfg: https://gist.github.com/giesberge/14fffc07ece83d2d33907890febfc46e Where it keeps adding spaces everytime I iterate on it to align these braces Iteration 0 TEST(MatrixTests,…
Eric
  • 28
  • 5
0
votes
1 answer

How do I make Uncrustify remove space before ? In a nullable type?

I'd like this line: private String ?user; to format to private String? user; Here's my uncrustify.cfg # # My favorite format # newlines = LF # AUTO (default), CRLF, CR,…
NetHawk
  • 1,392
  • 1
  • 15
  • 33
0
votes
1 answer

How do I configure Uncrustify to format on save in VS Code?

I have installed Uncrustify with Brew on Mac, and installed the extension on VS Code. I created an uncrustify.cfg and configured some rules. I would like to use Uncrustify to format the document on save. How can I do this in VS Code?
NetHawk
  • 1,392
  • 1
  • 15
  • 33
0
votes
0 answers

how can i prevent uncrustify removing space between namespace "static class" and formatting it to staticclass?

i am using qt beautifier uncrustify. Withouth namespace it doesnt remove space between "static class" but when i use it under namespace it removes space between formatting it to staticclass namespace{ static class myclass{ …
0
votes
0 answers

How do I properly configure Uncrustify indentation for nested designated initializers in an array?

I am trying to use Uncrustify version [Uncrustify-0.72.0_f] (on Windows 10) (https://github.com/uncrustify/uncrustify/releases/tag/uncrustify-0.72.0) to format a nested array (an array of structs) initialization in C with designated initializers. My…
CampbellB
  • 1
  • 1
0
votes
0 answers

Align chained method call in Java with Uncrustify

I want to Uncrustify to format this: IBuffer b = new Buffer(); b.add(1).add(1).add(2).add(3).add(4); to b.add(1) .add(2) .add(3) .add(4) Is there a way to achieve this? Thank you so much!
ttng_
  • 17
  • 5
0
votes
0 answers

Enforce new line before semi-colon in higher order function call

There is a C++ code snippet: Property register_props; register_props(key1, value1) (key2, value2) (key3, value3); Now I want to move the semi-colon to a seperated new line: Property register_props; register_props(key1,…
PM Extra
  • 427
  • 4
  • 17
0
votes
0 answers

align comma separated blocks in C uncrustify

I have been looking into uncrustify configuration but I can't find the option that turns this: uint8_t reg_values[] = {OP_MODE, 0x00, B_CURRENT, 0xDC, G_CURRENT, 0xC8, R_CURRENT, 0xF0, …
picatostas
  • 58
  • 8
0
votes
3 answers

How can I get Uncrustify (which has been unpublished from VSCode marketplace)

I have been using Laurent Treguier's Uncrustify extension but it has been recently unpublished. (https://marketplace.visualstudio.com/items?itemName=LaurentTreguier.uncrustify&ssr=false#overview) Any insights about this? Is this temporary or not? Do…