Format / check coding style
When to use
Use for formatting source files to project style or for checking style (e.g. when cit.py -l fails or the user asks to format code).
Commands (run from repo root)
Check only (no writes, fail if any file would change):
bash
env/bin/format-all-sources.py -dqn
- •
-d: only files different from origin/master - •
-q: quiet - •
-n: dry run (no writes; prints violations to stderr)
This is what cit.py -l runs. Use it to see which files would need formatting.
Format in-place (fix style):
bash
env/bin/format-all-sources.py -d
- •
-d: only files different from origin/master (omit to format all project sources) - •Without
-n: writes changes with clang-format-i.
Format all tracked project sources (no -d):
bash
env/bin/format-all-sources.py
Scope
- •Includes:
*.h,*.hpp,*.inl,*.c,*.cpp, and other listed extensions under git. - •Excludes: paths containing
3rdpartyor3rd-party.
Lint vs format
- •Lint (style check):
env/bin/cit.py -lorformat-all-sources.py -dqn. Use to verify CI style. - •Format (fix):
format-all-sources.pyorformat-all-sources.py -d. Use after editing to fix style before committing.
Verification
- •Check: exit 0 and no stderr output = no violations.
- •Format: exit 0; re-run
-dqnto confirm clean.