ci(pre-commit): add pre-commit and commitizen
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
78e3a42c4b
commit
fc6f3c54a8
2 changed files with 74 additions and 0 deletions
50
.cz.toml
Normal file
50
.cz.toml
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
[tool.commitizen]
|
||||||
|
name = "cz_customize"
|
||||||
|
tag_format = "$version"
|
||||||
|
version_scheme = "semver"
|
||||||
|
version = "0.0.1"
|
||||||
|
update_changelog_on_bump = true
|
||||||
|
major_version_zero = true
|
||||||
|
|
||||||
|
[tool.commitizen.customize]
|
||||||
|
message_template = """\
|
||||||
|
{{ change_type }}{% if scope %}({{ scope }}){% endif %}: {{ subject }}\
|
||||||
|
|
||||||
|
{% if body %}{{ body }}{% endif %}
|
||||||
|
"""
|
||||||
|
example = "day(01): solve part 1"
|
||||||
|
schema = "‹type›‹optional scope, e.g., day›: ‹message›\n\n‹body›"
|
||||||
|
schema_pattern = """\
|
||||||
|
(?s)\
|
||||||
|
(chore|ci|day|fix|feat)\
|
||||||
|
(\\(\\S+\\))?!?:\
|
||||||
|
( [^\\n\\r]+)\
|
||||||
|
((\\n\\n.*)|(\\s*))?$\
|
||||||
|
"""
|
||||||
|
|
||||||
|
[[tool.commitizen.customize.questions]]
|
||||||
|
name = "change_type"
|
||||||
|
message = "Select the type of change you are commiting"
|
||||||
|
type = "list"
|
||||||
|
choices = ["day", "feat", "fix", "chore", "ci"]
|
||||||
|
|
||||||
|
[[tool.commitizen.customize.questions]]
|
||||||
|
name = "scope"
|
||||||
|
message = "What is the scope of this change, e.g., day or part of the utils?"
|
||||||
|
type = "input"
|
||||||
|
|
||||||
|
[[tool.commitizen.customize.questions]]
|
||||||
|
name = "subject"
|
||||||
|
message = """\
|
||||||
|
Write a short and imperative summary of the code changes\
|
||||||
|
(lower case and no period):\
|
||||||
|
"""
|
||||||
|
type = "input"
|
||||||
|
|
||||||
|
[[tool.commitizen.customize.questions]]
|
||||||
|
name = "body"
|
||||||
|
message = """\
|
||||||
|
Provide additional contextual information about the code changes\
|
||||||
|
(press [enter] to skip):
|
||||||
|
"""
|
||||||
|
type = "input"
|
24
.pre-commit-config.yaml
Normal file
24
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
repos:
|
||||||
|
- hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: check-yaml
|
||||||
|
- id: check-added-large-files
|
||||||
|
repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.5.0
|
||||||
|
|
||||||
|
- hooks:
|
||||||
|
- args:
|
||||||
|
- --autofix
|
||||||
|
files: \.kt$
|
||||||
|
id: pretty-format-kotlin
|
||||||
|
repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
||||||
|
rev: v2.12.0
|
||||||
|
|
||||||
|
- hooks:
|
||||||
|
- id: commitizen
|
||||||
|
- id: commitizen-branch
|
||||||
|
stages:
|
||||||
|
- push
|
||||||
|
repo: https://github.com/commitizen-tools/commitizen
|
||||||
|
rev: v3.15.0
|
Loading…
Reference in a new issue