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

How to "unbreak" C code with "Artistic Style"

With Artistic Style code formatter, how do I achieve the opposite of --break-after-logical / -xL such that if I have... if (thisVariable1 == thatVariable1 || thisVariable2 == thatVariable2 || thisVariable3 == thatVariable3) …
puk
  • 16,318
  • 29
  • 119
  • 199
7
votes
3 answers

What option should be used to remove extra spaces using astyle?

How can I remove extra spaces from my code using astyle? For example I want to convert the following code: void foo ( int a , int c ) { d = a+ c; } to this: void foo (int a, int c) { d = a + c; } But astyle is currently…
B Faley
  • 17,120
  • 43
  • 133
  • 223
5
votes
3 answers

How to format opening braces in C++ methods with astyle?

Is a common practice to move function's opening brace to next line. How to apply this in class method with astyle (code beautifier)? example: // this is an initial C++ code class Class { public: static int foo(bool x) { if (x) { …
Kokos
  • 442
  • 4
  • 12
5
votes
2 answers

astyle: problems excluding files and directories using the "--exclude" option

I recently hit a usage problem with astyle that I have been unable to figure out. I am not sure if this is a bug, or I am simply using the astyle tool incorrectly. I am attempting to use the "--exclude" option to omit files and directories from…
bwallace
  • 131
  • 1
  • 1
  • 4
5
votes
1 answer

Auto format feature in Dev-C++ IDE

In Eclipse I would always use Ctrl + shift + f to autoformat code in the IDE. Is there a similar feature in Dev-C++, or some plugin available that I can use for formatting my C/C++ code?
ChristianF
  • 1,735
  • 4
  • 28
  • 56
4
votes
1 answer

AStyle nested class formatting

I have the following code in my project: class RangeConverter { private: struct Converter { double MinimumInput; double MaximumInput; double MinimumOutput; double…
user14416
  • 2,922
  • 5
  • 40
  • 67
4
votes
1 answer

Astyle like library for PHP and Javascript

Astyle is excellent code formatter for Java C# C++ eta al but it does not format PHP nor Javascrpt. Is there any free opensource code formatter for PHP and Javascript? Google is not very helpful for this case. NB: I need a C/C++ library as that is a…
Stefano Mtangoo
  • 6,017
  • 6
  • 47
  • 93
3
votes
3 answers

AnkhSVN client side pre-commit hook

Basically I want to do the same thing as the fella over there. It seems that everybody was thinking about server-side hooks (with all their evil potential). I want a client side script be run before commit so astyle can format the code the way my…
santa
  • 983
  • 9
  • 30
3
votes
1 answer

Format nested namespaces in C++ on one line using astyle

In my company's coding convention, we format nested namespaces on one line. For example: namespace Foo { namespace Bar { ... }} // Foo::Bar I am trying to enforce this style using astyle but could not find anything in the documentation at…
shibumi
  • 378
  • 2
  • 11
3
votes
1 answer

Can astyle handle array initialization braces different?

I have the following code snippet, which is exactly like I want it: #include int main(int argc, char* argv[]) { for (auto i: { 1, 2, 3 }) { std::cout << i << std::endl; } } Unfortunately astyle turns this…
bgp2000
  • 1,070
  • 13
  • 32
3
votes
0 answers

run astyle on files on git commit

I'm trying to tidy up my code, so i'd like to always run astyle on the needed files before doing a commit. I've seen answers mentioning a pre-commit hook, and using gitattributes, but they both commit the file contents as they were BEFORE running…
Joao Pincho
  • 939
  • 2
  • 11
  • 26
3
votes
1 answer

Can I list files that would be formatted with astyle?

Does astyle have an option that would do something like: "For the given list of files, list the files that *would be* modified by astyle." So, basically list the files that don't conform with astyle, but don't actually change them. I looked…
Bitdiot
  • 1,506
  • 2
  • 16
  • 30
3
votes
1 answer

Astyle formatting of all the documents in a folder and create no back up files

I just started using astyle. Is it possible to run astyle on all the files in a folder ? If the folder has files with different formats, can it wisely choose C/C++ files alone to format ? Is it possible to link astyle to gedit so that the programs…
Sai
  • 377
  • 2
  • 7
  • 18
3
votes
0 answers

Format multiline comments with AStyle

Is there a way to format multiline comments with AStyle? For example force comment blocks to maximum length of 80 characters.
sorush-r
  • 10,490
  • 17
  • 89
  • 173
3
votes
1 answer

After installing astyle , command astyle does not work

$cd astyle/build/mac $make $bin/astyle I cannot set native locale, reverting to English
Emerson
  • 85
  • 1
  • 9
1
2 3 4