Uncrustify

Source Code Beautifier for C, C++, C#, D, Java, and Pawn


Introduction

The goals of this project are simple: 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
  • Highly configurable - 134 configurable options as of version 0.0.24

See some example output.


Where to get

Sourceforge project web site
Download Uncrustify 0.26 source
The change log is here

Want to help?

The most helpful way is to try it out and give feedback. Documentation and examples are available in the source tree, so check it out.

You can find a copy of the configurable parameters here.
Here is the config file for my favorite style. And one I set up for Linux.
And here is a before and after C source example.
That should give you a pretty good idea of what Uncrustify can do.

If you find a bug, please do the following:

  • Reduce the input source file to the minimum that still has the problem
  • Use the sourceforget.net bug tracker
  • Attach the input source file, the configuration file, and a file that contains the expected output

If you want to add a feature, fix a bug, or implement missing functionality, feel free to do so! Patches are welcome! Here are some areas that need attention:

  • Test Java support and provide feedback (or patches!)
  • This web page need a (re)design
  • A logo of some sort
  • Examples that can be put on this website to show off what Uncrustify can do
  • Anything else that you want to do to make it better?

Portability

I'm pretty sure that I'm not using anything that is OS-specific.
The software has been tested on the following operating systems:

  • Linux (Ubuntu)
  • QNX (6.2.1)
  • OS X (DMG file available thanks to Jim Hopper)
  • OpenBSD 3.4
  • NetBSD 1.6.1
  • Sun Solaris 9
  • Windows XP (binary available)

Links


$Id: index.html 498 2006-09-09 14:17:59Z bengardner $