-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
55 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,39 @@ | ||
# version-file which will write or read current semver | ||
version-file = "internal/version/version" | ||
|
||
# hook scripts | ||
[hooks] | ||
|
||
# after version calc, | ||
# with use the {{ .Version }} to upgrade other files. | ||
post-version = [ | ||
"sed -i -e 's/\"version\": \"[^\"]*\"/\"version\": \"{{ .Version }}\"/g' testdata/pacakge.json", | ||
"sed -i -e 's/version: [^\\n]*/version: {{ .Version }}/g' testdata/pubspec.yaml" | ||
] | ||
|
||
# git hook pre commit | ||
pre-commit = [ | ||
"golangci-lint run", | ||
"husky lint-staged", | ||
] | ||
|
||
# git hook commit msg | ||
commit-msg = [ | ||
"husky lint-commit", | ||
] | ||
|
||
# list staged files do some pre-process and git add | ||
[lint-staged] | ||
"*.go" = [ | ||
"goimports -l -w", | ||
"gofmt -l -w", | ||
] | ||
|
||
# commit msg rule default support conventional commits | ||
[lint-commit] | ||
email = "^([email protected]|[email protected]|[email protected])$" | ||
# could check if this exists | ||
# email = "^([email protected]|[email protected])$" | ||
# optional custom types check regex | ||
# types = "^(feat|fix|build|chore|ci|docs|perf|refactor|revert|style|test)$" | ||
# optional header check regex | ||
# header = "^(?P<type>\w+)(\((?P<scope>[\w/.-]+)\))?(?P<breaking>!)?:( +)?(?P<header>.+)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,30 +20,50 @@ install git hooks | |
husky init | ||
``` | ||
|
||
## Configuration `.husky.yaml` | ||
|
||
```yaml | ||
hooks: | ||
# hook scripts | ||
pre-commit: | ||
- golangci-lint run | ||
- husky lint-staged | ||
commit-msg: | ||
- husky lint-commit | ||
|
||
## Configuration `.husky.toml` | ||
|
||
`.husky.yaml` supported too. | ||
|
||
```toml | ||
# version-file which will write or read current semver | ||
version-file = "internal/version/version" | ||
|
||
# hook scripts | ||
[hooks] | ||
|
||
# after version calc, | ||
# with use the {{ .Version }} to upgrade other files. | ||
post-version = [ | ||
"sed -i -e 's/\"version\": \"[^\"]*\"/\"version\": \"{{ .Version }}\"/g' testdata/pacakge.json", | ||
"sed -i -e 's/version: [^\\n]*/version: {{ .Version }}/g' testdata/pubspec.yaml" | ||
] | ||
|
||
# git hook pre commit | ||
pre-commit = [ | ||
"golangci-lint run", | ||
"husky lint-staged", | ||
] | ||
|
||
# git hook commit msg | ||
commit-msg = [ | ||
"husky lint-commit", | ||
] | ||
|
||
# list staged files do some pre-process and git add | ||
lint-staged: | ||
"*.go": | ||
- gofmt -l -w | ||
|
||
# commit msg rule only support conventionalcommits | ||
lint-commit: | ||
# could check if this exists | ||
email: "^([email protected]|[email protected])$" | ||
# optional custom types check regex | ||
types: "^(feat|fix|build|chore|ci|docs|perf|refactor|revert|style|test)$" | ||
# optional header check regex | ||
header: "^(?P<type>\w+)(\((?P<scope>[\w/.-]+)\))?(?P<breaking>!)?:( +)?(?P<header>.+)" | ||
[lint-staged] | ||
"*.go" = [ | ||
"goimports -l -w", | ||
"gofmt -l -w", | ||
] | ||
|
||
# commit msg rule default support conventional commits | ||
[lint-commit] | ||
# could check if this exists | ||
# email = "^([email protected]|[email protected])$" | ||
# optional custom types check regex | ||
# types = "^(feat|fix|build|chore|ci|docs|perf|refactor|revert|style|test)$" | ||
# optional header check regex | ||
# header = "^(?P<type>\w+)(\((?P<scope>[\w/.-]+)\))?(?P<breaking>!)?:( +)?(?P<header>.+)" | ||
``` | ||
|
||
Commit msg rule follow <https://www.conventionalcommits.org/en/v1.0.0/> | ||
|