Files
container/scripts/pre-commit.fmt
T
J Logan b1577d8d07 Adds opt-in pre-commit hook for format and header checks. (#1062)
- Closes #639.
- Adds swift format configuration that removes lint checks so we can use
`swift lint` to perform format-only tests.
- Adds `check` target that invokes format and header checks.
- Adds pre-commit script that runs `make check`.
- Adds `pre-commit` target that installs the check script as a
pre-commit hook.

## Type of Change
- [ ] Bug fix
- [x] New feature  
- [ ] Breaking change
- [x] Documentation update

## Motivation and Context
Avoids wasting time and commit rewrites.

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [x] Added/updated docs
2026-01-16 15:50:47 -08:00

17 lines
315 B
Bash
Executable File

#! /bin/bash -e
setup_error() {
echo failed to run: $1 1>&2
echo run '"make pre-commit"' and try again 1>&2
exit 1
}
if [ ! -z "${PRECOMMIT_NOFMT}" ] ; then
exit 0
fi
echo checking formatting and licenses 1>&2
project_pathname=$(git rev-parse --show-toplevel)
cd "${project_pathname}"
make check