LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Code beautifier (https://www.linuxquestions.org/questions/programming-9/code-beautifier-590488/)

fuzzyBuzz 10-09-2007 06:26 AM

Code beautifier
 
Looking for software that takes code source file and beatifies by:
- indentation;
- spacing;
- making bracket style consistent.

Any suggestions?

dmail 10-09-2007 07:42 AM

Don't most IDE's have this functionality?

fuzzyBuzz 10-09-2007 07:48 AM

Quote:

Originally Posted by dmail (Post 2918280)
Don't most IDE's have this functionality?

The first feature i mentioned is widely available.
The 2nd and 3rd features are also widely available while typing the code, but not for existing source files.

Hko 10-09-2007 07:49 AM

Quote:

Originally Posted by zvirack (Post 2918220)
Looking for software that takes code source file and beatifies by:
- indentation;
- spacing;
- making bracket style consistent.

Any suggestions?

Install and try the program "indent".
Virtually all distro's provide it.

dmail 10-09-2007 07:55 AM

Quote:

Originally Posted by zvirack (Post 2918286)
The first feature i mentioned is widely available.
The 2nd and 3rd features are also widely available while typing the code, but not for existing source files.

from kdevelop docs
http://docs.kde.org/stable/en/kdevel...lop/setup.html
Quote:

Selecting a Source Format Style

KDevelop automatically formats a source text in a predefined style. This style is highly configurable.
Note

The reformat source feature is currently available for C, C++, and Java™ only. Especially you cannot use it for scripting languages like e.g. PHP. This is because KDevelop uses the astyle application to implement this feature.

To set up a specific format style, select Settings->Configure KDevelop.. from the menubar. The Customize KDevelop dialog will pop up, where you have to select Source Formatter in the left hand tree. This will display a series of three settings dialog tabs to the right, namely a General Formatting Setup, a Indentation Style Setup, and a Other Formatting Setup.
Tip

Any style changes apply to newly entered text only. If you want to change the formatting style of an already existing source text you will have to explicitely use the Edit->Reformat Source command.

fuzzyBuzz 10-09-2007 08:10 AM

Quote:

Originally Posted by Hko (Post 2918289)
Install and try the program "indent".
Virtually all distro's provide it.

Does it provide all 3 features? Any link to it's documentation?

fuzzyBuzz 10-09-2007 08:12 AM

Quote:

Originally Posted by dmail (Post 2918296)

Nice. Never knew about this. I'll check it out.

matthewg42 10-09-2007 08:38 AM

There's indent, astyle, bcpp perltidy, tidy, hindent, xmlindent. Depends on the code / document type you want to use it with, which you didn't mention by the way.

fuzzyBuzz 10-09-2007 09:09 AM

I do mostly c/c++, but some Java too.

matthewg42 10-09-2007 09:35 AM

astyle and indent will probably do what you want then, else you might consider one of the formatters building into an IDE. For Java, you can use Eclipse for this. I think astyle does Java code too, although I've only ever used it for C & C++

Hko 10-09-2007 09:40 AM

Quote:

Originally Posted by zvirack (Post 2918317)
Does it provide all 3 features? Any link to it's documentation?

Yes. But it does not do java AFAIK.


All times are GMT -5. The time now is 07:29 PM.