From 457b0a97eca546ae176e462adbbe753923d7b2a1 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Thu, 22 Feb 2024 16:51:33 +0100 Subject: [PATCH] ci(cz): add commitizen Signed-off-by: Matej Focko --- .cz.toml | 26 ++++++++++++++++++++++++++ .pre-commit-config.yaml | 7 +++++++ 2 files changed, 33 insertions(+) create mode 100644 .cz.toml diff --git a/.cz.toml b/.cz.toml new file mode 100644 index 0000000..4041e5b --- /dev/null +++ b/.cz.toml @@ -0,0 +1,26 @@ +[tool] +[tool.commitizen] +name = "cz_customize" + +[tool.commitizen.customize] +message_template = "{{type_lang}}: add «{{problem}}»" +example = "cpp: add «997. Find the Town Judge»" +schema = "‹type_lang›: ‹message›" +schema_pattern = """\ + (?s)\ + (chore|ci|cpp|cs|go|java|js|kt|rb|rs|swift)\ + (\\(\\S+\\))?!?:\ + ( [^\\n\\r]+)\ + ((\\n\\n.*)|(\\s*))?$\ +""" + +[[tool.commitizen.customize.questions]] +type = "list" +name = "type_lang" +choices = ["cpp", "cs", "go", "java", "js", "kt", "rb", "rs", "swift", "chore", "ci"] +message = "Select the language (or type of change) you are commiting" + +[[tool.commitizen.customize.questions]] +type = "input" +name = "problem" +message = "Type the problem name in form of: ‹number. Name›" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1767d99..0b7c576 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,3 +15,10 @@ repos: files: \.rs$ - id: clang-format files: \.cpp$ +- repo: https://github.com/commitizen-tools/commitizen + rev: v3.15.0 + hooks: + - id: commitizen + - id: commitizen-branch + stages: + - push