mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-01 18:56:52 +00:00
New hook for enforcing branch name
Use a regex to validate the naming convention the branch should follow. If it's not correct, it fails.
This commit is contained in:
parent
ee30c6ada9
commit
86d5ab84cb
4 changed files with 58 additions and 0 deletions
12
README.md
12
README.md
|
|
@ -210,6 +210,18 @@ Trims trailing whitespace.
|
|||
- By default, this hook trims all whitespace from the ends of lines.
|
||||
To specify a custom set of characters to trim instead, use `args: [--chars,"<chars to trim>"]`.
|
||||
|
||||
|
||||
#### `enforce-branch-name`
|
||||
Validates the branch name follows a pattern.
|
||||
- `-p` / `--pattern` is used to pass the regex a valid branch name should have.
|
||||
|
||||
Note that `enforce-branch-name` is configured by default to [`always_run`](https://pre-commit.com/#config-always_run).
|
||||
As a result, it will ignore any setting of [`files`](https://pre-commit.com/#config-files),
|
||||
[`exclude`](https://pre-commit.com/#config-exclude), [`types`](https://pre-commit.com/#config-types)
|
||||
or [`exclude_types`](https://pre-commit.com/#config-exclude_types).
|
||||
Set [`always_run: false`](https://pre-commit.com/#config-always_run) to allow this hook to be skipped according to these
|
||||
file filters. Caveat: In this configuration, empty commits (`git commit --allow-empty`) would always be allowed by this hook.
|
||||
|
||||
### Deprecated / replaced hooks
|
||||
|
||||
- `check-byte-order-marker`: instead use fix-byte-order-marker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue