Uncrustify

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

Travis CI Build Status Coverity Scan Build Status

Introduction

The goals of this project are simple: Create a highly configurable, easily modifiable source code beautifier.


Features

  • Indent 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
  • Supports embedded SQL 'EXEC SQL' stuff
  • Highly configurable - 850 configurable options as of version 0.78.1

See some example output.


Where to get Uncrustify

Project Websites

Sourceforge project web site
Release downloads
Freshmeat Project
Git Hub

Source Code

As of release 0.54, the source code is maintained in a Git repository.

The public Git URL for Sourceforge.net is
git://uncrustify.git.sourceforge.net/gitroot/uncrustify/uncrustify

The public Git URL for github.com is
git://github.com/uncrustify/uncrustify.git

Prebuilt binaries

Windows (i386) : Sourceforge

Universal Indent GUI

Universal Indent GUI is a cross-platform graphical configuration file editor for many code beautifiers, including Uncrustify.

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 the output from 'uncrustify --show-config' here.
Here is the default config file. 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!)
  • Test Objective C support and provide feedback (or patches!)
  • Test Embedded SQL to see what works
  • 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?

Project Mailing list

We don't have a mailing list for Uncrustify.
We are using github.
You may use Issues to publish an error report.
Or PR to make a bugfix proposal.

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
  • QNX
  • OS X
  • FreeBSD, NetBSD, OpenBSD
  • Sun Solaris 9
  • Windows XP (binary available)

Links

Distributions that package Uncrustify


"Support This Project"