tomh@5945: /** tomh@5945: * \ingroup utils tomh@5945: * \defgroup CheckStyle check-style.py tomh@5945: * tomh@5945: * The check-style.py script will test and reformat code according to the tomh@5945: * ns-3 coding style posted at http://www.nsnam.org/codingstyle.html tomh@5945: * It requires that you install 'uncrustify' tomh@5945: * tomh@5945: * It has multiple levels of conformance: tomh@5945: * - level=0: the default: merely checks indentation tomh@5945: * - level=1: checks also for missing spaces before parentheses tomh@5945: * - level=2: checks also for missing newlines and braces around single-line statements tomh@5945: * - level=3: checks also for missing trailing whitespaces tomh@5945: * tomh@5945: * Examples: tomh@5945: * tomh@5945: * check a single file (level 0 by default): tomh@5945: \verbatim tomh@5945: ./check-style.py -f src/core/object.h tomh@5945: \endverbatim tomh@5945: * tomh@5945: * fix the style of a single file: tomh@5945: \verbatim tomh@5945: ./check-style.py --level=2 --in-place -f src/core/object.h tomh@5945: \endverbatim tomh@5945: * tomh@5945: * look at the changes needed for a single file: tomh@5945: \verbatim tomh@5945: ./check-style.py --diff --level=1 -f src/core/object.h | less tomh@5945: \endverbatim tomh@5945: * tomh@5945: * look at the status of all files modified in your mercurial repository: tomh@5945: \verbatim tomh@5945: ./check-style.py --check-hg tomh@5945: \endverbatim tomh@5945: * tomh@5945: * look at the changes needed for all modified files in your mercurial tomh@5945: * repository: tomh@5945: \verbatim tomh@5945: ./check-style.py --check-hg --diff |less tomh@5945: \endverbatim tomh@5945: * tomh@5945: * Enable this script to run as a 'commit' hook in your repository and tomh@5945: * disallow commits which contain files with invalid style: tomh@5945: * tomh@5945: \verbatim tomh@5945: cat hgrc (can be appended to .hg/hgrc or ~/.hg/hgrc or /etc/hg/hgrc tomh@5945: [hooks] tomh@5945: # uncomment below line to enable: works only with mercurial >= 1.3 tomh@5945: #pretxncommit.indent = path-to-binary/check-indent.py --check-hg-hook tomh@5945: # uncomment below line to enable: works with all (?) versions tomh@5945: # of mercurial but requires that PYTHONPATH is defined to point to tomh@5945: # the directory which contains check-indent.py tomh@5945: #pretxncommit.indent = python:check-indent.run_as_hg_hook tomh@5945: \endverbatim tomh@5945: * tomh@5945: * Usage: tomh@5945: \verbatim tomh@5945: Usage: check-style.py [options] tomh@5945: tomh@5945: Options: tomh@5945: -h, --help show this help message and exit tomh@5945: --debug Output some debugging information tomh@5945: -l LEVEL, --level=LEVEL tomh@5945: Level of style conformance: higher levels include all tomh@5945: lower levels. level=0: re-indent only. level=1: add tomh@5945: extra spaces. level=2: insert extra newlines and extra tomh@5945: braces around single-line statements. level=3: remove tomh@5945: all trailing spaces tomh@5945: --check-hg-hook Get the list of files to check from mercurial's list tomh@5945: of modified and added files and assume that the script tomh@5945: runs as a pretxncommit mercurial hook tomh@5945: --check-hg Get the list of files to check from mercurial's list tomh@5945: of modified and added files tomh@5945: -f FILE, --check-file=FILE tomh@5945: Check a single file tomh@5945: --diff Generate a diff on stdout of the indented files tomh@5945: -i, --in-place Indent the input files in-place tomh@5945: \endverbatim tomh@5945: */