refactor: Switch to conventional scripts, rather than custom script (#535)
This commit is contained in:
parent
1275934ac1
commit
6b9c6c8b9c
|
|
@ -1,31 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
commitmsg = ""
|
|
||||||
|
|
||||||
with open('.git/COMMIT_EDITMSG', mode='r') as f:
|
|
||||||
commitmsg = f.readline().strip()
|
|
||||||
|
|
||||||
print("Commit message is: " + commitmsg)
|
|
||||||
|
|
||||||
ALLOWED_COMMIT_TYPES = [
|
|
||||||
"cicd",
|
|
||||||
"test",
|
|
||||||
"refactor",
|
|
||||||
"depbump",
|
|
||||||
"typo",
|
|
||||||
"fmt",
|
|
||||||
"doc",
|
|
||||||
"bugfix",
|
|
||||||
"security",
|
|
||||||
"feature",
|
|
||||||
]
|
|
||||||
|
|
||||||
for allowedType in ALLOWED_COMMIT_TYPES:
|
|
||||||
if commitmsg.startswith(allowedType + ":"):
|
|
||||||
print("Allowing commit type: ", allowedType)
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
print("Commit message should start with commit type. One of: ", ", ".join(ALLOWED_COMMIT_TYPES))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
@ -14,7 +14,7 @@ Helpful information to understand the project can be found here: [CONTRIBUTING](
|
||||||
Please put a X in the boxes as evidence of reading through the checklist.
|
Please put a X in the boxes as evidence of reading through the checklist.
|
||||||
|
|
||||||
- [ ] I have forked the project, and raised this PR on a feature branch.
|
- [ ] I have forked the project, and raised this PR on a feature branch.
|
||||||
- [ ] `make githooks` has been run, and my git commit message was accepted by the git hook.
|
- [ ] I ran the `pre-commit` hooks, and my commit message was validated.
|
||||||
- [ ] `make daemon-compile` runs without any issues.
|
- [ ] `make daemon-compile` runs without any issues.
|
||||||
- [ ] `make daemon-codestyle` runs without any issues.
|
- [ ] `make daemon-codestyle` runs without any issues.
|
||||||
- [ ] `make daemon-unittests` runs without any issues.
|
- [ ] `make daemon-unittests` runs without any issues.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
---
|
||||||
# See https://pre-commit.com for more information
|
# See https://pre-commit.com for more information
|
||||||
# See https://pre-commit.com/hooks.html for more hooks
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
repos:
|
repos:
|
||||||
|
|
@ -8,3 +9,11 @@ repos:
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
|
|
||||||
|
# Alternative semantic commit checker
|
||||||
|
- repo: https://github.com/compilerla/conventional-pre-commit
|
||||||
|
rev: v3.1.0
|
||||||
|
hooks:
|
||||||
|
- id: conventional-pre-commit
|
||||||
|
stages: [commit-msg]
|
||||||
|
args: [] # optional: list of Conventional Commits types to allow e.g. [feat, fix, ci, chore, test]
|
||||||
|
|
|
||||||
3
Makefile
3
Makefile
|
|
@ -40,9 +40,6 @@ daemon-unittests:
|
||||||
it:
|
it:
|
||||||
cd integration-tests && make
|
cd integration-tests && make
|
||||||
|
|
||||||
githooks:
|
|
||||||
git config --local core.hooksPath .githooks
|
|
||||||
|
|
||||||
go-tools:
|
go-tools:
|
||||||
go install "github.com/bufbuild/buf/cmd/buf"
|
go install "github.com/bufbuild/buf/cmd/buf"
|
||||||
go install "github.com/fzipp/gocyclo/cmd/gocyclo"
|
go install "github.com/fzipp/gocyclo/cmd/gocyclo"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue