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

Can Uncrustify be configured to align braces in one-line functions in header files?

Scenario: C++, a bunch of one-line setters and getters inlined in the header file, as follows: bool hasVoices(int staffIdx) const { return m_mstaves[staffIdx]->hasVoices(); } void setHasVoices(int staffIdx, bool v) …
Isaac
  • 101
  • 1
0
votes
1 answer

uncrustify: how to alter the struct initialization braces

I am using uncrustify 0.69.0 (I can't get 0.71.0 to compile yet). I have the following: static struct { unsigned char streamid[2]; uint32_t adr; } plus_crap[3] = { { { 0x00, 0x00 }, 0 }, { { 0x00, 0x00 }, 0 }, { { 0x00, 0x00 }, 0 }…
oldunixguy
  • 31
  • 3
0
votes
1 answer

Uncrustify - whats adding space between 'assert' and '('

No matter how I update the config file I seem to always end up with a space System.assert(true); becomes System.assert (true); This is only when the function is called assert The following both format without a space before the…
Amelia
  • 1
  • 1
0
votes
1 answer

Uncrustify: Align all left shifts in all lines

I try to make uncrustify to go from: std::cout << "Rho P " << this->myThermo->getConst("rhoSolide") << "\n"; std::cout << "MDB = " << mdb << "\n"; std::cout << "MDC = " << mdc << "\n"; std::cout << "T = " << T << "\n"; std::cout…
Jouke
  • 61
  • 6
0
votes
1 answer

Uncrustify - How to not add space between =>

In apex we use => when defining maps. It is invalid syntax to have a space in between such as = >. I have tried the following settings all of which result in a space between. sp_compare = ignore sp_inside_angle = ignore sp_assign =…
Amelia
  • 1
  • 1
0
votes
0 answers

Uncrustify: How to add a new line before declare or assign variable?

Using the Uncrustify Code beautifier, How to add new line before declare and assign a variable ? I want to convert this: void Function() { int a; function(); a = 1; int b = a; function(); function(); } To this expected…
KammutierSpule
  • 109
  • 1
  • 5
0
votes
0 answers

uncrustify: Can I configure it to completely reformat a line?

When I use uncrustify to format lines of code like: functionCall(quiteLongAndWordyArgument1, quiteLongAndWordyArgument2, quiteLongAndWordyArgument3, shortArgument); functionCall(quiteLongAndWordyArgument1, quiteLongAndWordyArgument2,…
Bri Bri
  • 2,169
  • 3
  • 19
  • 44
0
votes
0 answers

How do I keep uncrustify from adding a space between opening parenthesis and ampersand (&

I would like to remove the space after decltype( in the following SFINAE test: template static one test(typename std::remove_reference::type); Obviously, I don't want to lose spaces before ampersands in other…
Christian
  • 499
  • 6
  • 24
0
votes
1 answer

uncrustify C++: Transform multiple variable initialization per line posible?

is it possible by using uncrustify to transform this: int a, b, c, d=0; to this : int a; int b; int c; int d=0; Thanx
user1911091
  • 1,219
  • 2
  • 14
  • 32
0
votes
1 answer

vs2019 external tool uncrustify hide console

I have been able to successfully add and configure uncrustify as an external tool to vs2019. The problem I have is that the console window flashes each time uncrustify is executed (via keyboard shortcut). Is there a way to hide the console window or…
user1908746
0
votes
1 answer

uncrustify: can I control where it decides to break apart lines?

I've been trying out uncrustify and while I've gotten a lot of mileage out of how configurable it is, I found it occasionally decides to break apart lines in ways I don't agree with. Some examples: void functionWithLongName(int parameter1, int…
Bri Bri
  • 2,169
  • 3
  • 19
  • 44
0
votes
1 answer

how to indent continued function parameters with uncrustify?

Consider this code: some_function(1, 2 3); some_function( 1, 2, 3); Is there a way to make uncrustify indent the second line so that the 3 is in the column after the (? Preferably without changing the indent on the fourth line? The doc makes it…
Matthew
  • 2,593
  • 22
  • 25
0
votes
2 answers

Uncrustify configuration for objective-c

I am looking for configurations to use with Uncrustify, for Objective-C. Searches on google did not return nice configurations for this language.
rithik
  • 778
  • 1
  • 9
  • 21
0
votes
1 answer

uncrustify, c, align struct init member

I am looking for the parameter to align initialization. before: V_Zyle[Z1]=(Zylinder){&AP31[0], &AP31[1], &XP12_22_1, &XP12_22_2, 0, 0, ZY_PL}; // Z1 Drehzylinder Vereinzelung V_Zyle[Z2]=(Zylinder){&AP31[2], &AP31[3], NULL, NULL, 0, 0, ZY_GR}; …
0
votes
1 answer

Stop Uncrustify from aligning continued multiline conditional expression

I want to setup matching behavior for Visual Studio and Uncrustify so that instant formatting was not modified later by Uncrustify. I am almost there, but Uncrustify handles continued multiline expression excessively well. It aligns 2nd and other…