LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-09-2007, 06:26 AM   #1
fuzzyBuzz
Member
 
Registered: Sep 2005
Posts: 34

Rep: Reputation: 15
Code beautifier


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

Any suggestions?
 
Old 10-09-2007, 07:42 AM   #2
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Don't most IDE's have this functionality?
 
Old 10-09-2007, 07:48 AM   #3
fuzzyBuzz
Member
 
Registered: Sep 2005
Posts: 34

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by dmail View Post
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.
 
Old 10-09-2007, 07:49 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
Originally Posted by zvirack View Post
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.
 
Old 10-09-2007, 07:55 AM   #5
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Quote:
Originally Posted by zvirack View Post
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.
 
Old 10-09-2007, 08:10 AM   #6
fuzzyBuzz
Member
 
Registered: Sep 2005
Posts: 34

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Hko View Post
Install and try the program "indent".
Virtually all distro's provide it.
Does it provide all 3 features? Any link to it's documentation?
 
Old 10-09-2007, 08:12 AM   #7
fuzzyBuzz
Member
 
Registered: Sep 2005
Posts: 34

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by dmail View Post
Nice. Never knew about this. I'll check it out.
 
Old 10-09-2007, 08:38 AM   #8
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
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.
 
Old 10-09-2007, 09:09 AM   #9
fuzzyBuzz
Member
 
Registered: Sep 2005
Posts: 34

Original Poster
Rep: Reputation: 15
I do mostly c/c++, but some Java too.
 
Old 10-09-2007, 09:35 AM   #10
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
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++
 
Old 10-09-2007, 09:40 AM   #11
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
Originally Posted by zvirack View Post
Does it provide all 3 features? Any link to it's documentation?
Yes. But it does not do java AFAIK.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
small syntax problem with C code (implemented in Code Composer Studio) illiniguy3043 Programming 6 01-07-2008 02:14 AM
boot beautifier: aurora eantoranz Linux - Software 1 11-18-2005 04:01 PM
User Preferences: Use HTML code instead of vB code? (vB code is overrated) stefanlasiewski LQ Suggestions & Feedback 5 07-26-2005 01:37 AM
need HTML code beautifier lothario Linux - Software 1 08-03-2004 11:26 AM
Open Firmware code for booting OS from SATA : sample code available somewhere ? drsparikh Linux - Hardware 0 03-12-2004 11:16 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration