Questions tagged [astyle]

Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C# and Java programming languages. It can be used from a command line, or it can be incorporated as classes in another C++ program.

Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C# and Java programming languages.

There are command line options for defining bracket settings, indentation, white-space padding, and line endings. This can be applied to a single file, a set of files, or whole directory folders recursively. Additionally one can choose to create a backup file for each file touched.

For more information, see the project's official site

58 questions
1
vote
1 answer

Astyle Incorrectly Formatting Linux Style Braces

According to the Linux kernel coding style, if only one branch of a conditional statement is a single statement, then braces should be used in both branches. For example: if (condition) { do_this(); do_that(); } else…
Jonathan
  • 671
  • 1
  • 8
  • 21
1
vote
1 answer

Styling a C/C++ file on diffs

I have a requirement to style only the part of the C/C++ file which is getting committed (so the blame for the other lines are intact). Is there any tool to just do that? I know we can style the whole file and get the blame to ignore styling changes…
LizzeBennet
  • 197
  • 1
  • 1
  • 13
1
vote
0 answers

AStyle: indentation for one-line block

Is it possible using AStyle formatting tool add indention for brackets and parens in one-line block? What I have: int f(int i)const{return 42;} What I want to reach: int f(int i) const { return 42; } Default formatting with…
αλεχολυτ
  • 4,792
  • 1
  • 35
  • 71
1
vote
0 answers

How to tell astyle to bracket one line for and while loops?

astyle allows bracketing one line conditional statements using the option j. So, the code: // test.cpp if (x == 0) break; can be formatted using the command: astyle -j test.cpp to format test.cpp as: if (x == 0) { break; } Suppose, I need the…
Seshadri R
  • 1,192
  • 14
  • 24
1
vote
0 answers

Astyle C++ enum class indentation

Is there a way of getting Astyle to indent enum class elements to the same depth? I am getting the following: enum class test { test1 = 1, test2 = 2, test3 = 3, test4 = 4 …
John
  • 10,837
  • 17
  • 78
  • 141
1
vote
1 answer

Automatically indent the code without messing the tracking of changes in svn

I need to run astyle in a project with several source files. There's not a common IDE used by all developers, they develop in vi, gedit, Netbeans, Eclipse, etc. So I can't use a configuration file for indentation. In order to keep a standard in the…
eap
  • 168
  • 1
  • 1
  • 9
1
vote
1 answer

AStyle for Google C++ style guide

I just started using Astyle with VS-2013 for C++. I want to configure it to follow the Google C++ style guide. I noticed that Astyle allows configuration files to be imported, so I was wondering has somebody done the hard work and configured it to…
ahmadh
  • 1,582
  • 2
  • 18
  • 28
1
vote
1 answer

In vim I want to run astyle on the file i'm on when I save

When I save in vim I want to be able to run 'astyle sourceCodeThatImCurrentlyIn.cpp'. So a combination of :w and :!astyle source.c ? Is this possible? Thank you, Ejay
tomato
  • 831
  • 5
  • 15
  • 33
0
votes
1 answer

formatting functions parameter

Are you aware of any tool or program that is able to beautify the function input parameters making the variable left-aligned like the example below? I am having a look at A-Style right now. Do you know if it can do that job for me? I would like to…
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173
0
votes
1 answer

Is it possible to set line limitation in the AStyle

I am using AStyle to format C or cpp source codes. I am just wondering it is possible to set line limitation in the AStyle?
Chang
  • 3,953
  • 2
  • 30
  • 43
0
votes
3 answers

Integrating Artistic Style with Visual Studio 2010

Is it possible to integrate Artistic Style with Visual Studio 2010? It does a much better job of fixing mangled code indenting and styling than the include visual studio code formatter. Ideally a hotkey or something to apply it to the current file.…
Kyle
  • 63
  • 6
0
votes
0 answers

How to make clang-format not to align anything with spaces at all?

I want code to be formatted using tabs only, with no space alignment. Something like astyle -T -S -p -xg -H -U -xU does. For example, clang-format gives me the following results: SelEnd = StrSize; // а также считаем что все выделено - …
unxed
  • 196
  • 1
  • 3
  • 6
0
votes
0 answers

How to force clang-format break after variable type?

I couldn't make clang-format make code like this static inline return_type_t foo( long_name_arg1_t **a, arg2_t b, arg3_t *c ) { var_type_t var1, var2, var3; var_type_t const constant =…
Pavel.Zh
  • 437
  • 3
  • 15
0
votes
0 answers

How to set Astyle so that it does not format two braces on the same line

When encountering the following code, while(c >= '0' && c <= '9') {x = x * 10 + c - 48; c = getchar();} Astyle will format it to while(c >= '0' && c <= '9') { x = x * 10 + c - 48; c = getchar(); } I don't want this to happen. So how to set…
Jochi Hua
  • 63
  • 5
0
votes
0 answers

astyle have problem with formatting templates

It convert: template >> void function(T in, Args... args) { } To : template
Ghasem Ramezani
  • 2,683
  • 1
  • 13
  • 32