Taken from a larger project of mine; may be out-of-sync.
Scripts that are used to keep a Git repository "tidy".
These commandline utilities are responsible for different aspects. For details, use --help.
clang_format.py: format a file or the repo with program clang-format (you need to install it) according to the repo's.clang-formatfile.whitespace.py: check whitespace discipline of one file or the repo, e.g. no tabs is C++ files.filename_match.py: check whether filename matches with the file name in the head comment of a file.dirname_discipline.py: check directory name discipline, e.g.unit-test/exists ifinclude/exists, and no conflicting module names.
Each script above can be used as a Python library as well.
Executing all.py at the repo root will run all tidiness checkers altogether.
If clang-format is not installed, or .clang-format is missing, then clang_format.py is skipped.
all.py --help gives the help message.
This directory is also a Python package, so you may use it like this:
import tidy.whitespace
# do some work...
all.pyis recommended to be added to Git'spre-commitscript.
Yes. Beside dirname_discipline, it only checks staged files that are created/modified reported by command git status.