uncrustify
Configurable multi-language source code formatter
TLDR
Format a file and output to stdout
SYNOPSIS
uncrustify [options] [files ...]
DESCRIPTION
uncrustify is a highly configurable source code beautifier for C, C++, C#, Objective-C, D, Java, Pawn, and VALA. It automatically formats code according to specified style rules controlling indentation, spacing, alignment, and line breaks.
Configuration is controlled through a configuration file with hundreds of options. The default location is $UNCRUSTIFY_CONFIG or ~/.uncrustify.cfg. Generate a starting configuration with --show-config and customize incrementally.
uncrustify can process single files, file lists, or entire source trees. It supports in-place editing with optional backups.
PARAMETERS
-c cfg
Use specified configuration file (or '-' for defaults).-f file
Process single file, output to stdout.-o file
Write output to specified file.-F file
Read list of files to process (one per line, '-' for stdin).-l lang
Language override: C, CPP, D, CS, JAVA, PAWN, VALA, OC, OC+.--replace
Replace source files in place (creates backup).--no-backup
Replace files without backup.--mtime
Preserve modification time on replaced files.--frag
Treat input as code fragment with proper first-line indent.--show-config
Print active configuration to stdout.--update-config
Output new config file with current settings.--update-config-with-doc
Output config file with usage comments.--set key=value
Override configuration option.-q
Quiet mode, no stderr output.-h, --help
Display help message.--version
Display version information.
CONFIGURATION
$UNCRUSTIFY_CONFIG
Environment variable specifying the path to the configuration file.~/.uncrustify.cfg
Default user configuration file used when no -c option or environment variable is set.
CAVEATS
Configuration complexity is high; start with generated defaults and adjust gradually. Different code styles may require extensive configuration tuning. Always test on a backup or version-controlled code before using --no-backup.
HISTORY
uncrustify was created by Ben Gardner and first released in 2005. It was designed to be a highly flexible code formatter supporting multiple languages. The project has grown to support over 700 configuration options, making it one of the most configurable code formatters available.
SEE ALSO
clang-format(1), astyle(1), indent(1)
