Astyle là một tool rất tốt để format source code. Mỗi khi có source của cái gì đó là mình cứ format source trước đã rồi đọc gì thì đọc. Có thể dùng astyle làm hook pre-commit cho các source version control. Đây là .astylerc đặt ở home directory
# Author : Hoang Tran <tran.hoang@gmail.com>
# Version : 1.1
# Last Change: Aug 03, 2009# Predefined style option -A3
–style=k&r# Indent using 4 spaces per indent. Don’t use tab -s4
–indent=spaces=4# Break brackets from namespace, class and function definitions,
# but attach brackets to statements within a function -l
–brackets=linux# Indent ’switch’ blocks so that the ‘case X:’ statement are
# indented in the switch block. -S
–indent-switches# Indent multi-line preprocessor definitions ending with a backslash -w
–indent-preprocessor# Pad empty lines around header blocks (eg. ‘if’, ‘while’ …) -f
–break-blocks# Delete empty lines within a function or method. -x
–delete-empty-lines# Insert space padding around operators. -p
–pad-oper# Remove extra space padding around parenthesis on the inside and outside -U
–unpad-paren# Converts tabs into spaces in the non-indentation part of the line -c
–convert-tabs# Do not retain a backup of the origional file
–suffix=none

