Amend approach for no-commit-to-branch to use regex matching based on

feedback. Adds --pattern optional argument which can be used alongside
--branch to block commits to a branch which matches a supplied
regex expression
This commit is contained in:
Marc Jay 2019-04-20 13:46:49 +01:00
parent d6847c4827
commit 8d2785b9d6
3 changed files with 22 additions and 9 deletions

View file

@ -79,10 +79,12 @@ Add this to your `.pre-commit-config.yaml`
- `name-tests-test` - Assert that files in tests/ end in `_test.py`.
- Use `args: ['--django']` to match `test*.py` instead.
- `no-commit-to-branch` - Protect specific branches from direct checkins.
- Use `args: [--branch, staging, --branch, master, --branch, release/*]` to set the branch.
- Use `args: [--branch, staging, --branch, master]` to set the branch.
`master` is the default if no argument is set.
- `-b` / `--branch` may be specified multiple times to protect multiple
branches.
- `-p` / `--pattern` can be used to protect branches that match a supplied regex
(e.g. `--pattern, release/.*`). May be specified multiple times.
- `pretty-format-json` - Checks that all your JSON files are pretty. "Pretty"
here means that keys are sorted and indented. You can configure this with
the following commandline options: