Skip to content

Commit 2581d35

Browse files
hjmjohnsonclaude
andcommitted
ENH: Configure commitizen for ITK commit message convention
Add commitizen configuration to pyproject.toml that enforces the ITK commit message convention (PREFIX: Description) with interactive prompts for selecting the change type. Valid prefixes: BUG, COMP, DOC, ENH, PERF, STYLE. The commitizen pre-commit hook in .pre-commit-config.yaml validates commit messages at the commit-msg stage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b4d793a commit 2581d35

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,47 @@ target-version = "py310"
1919
select = ["E", "F", "I", "UP", "B"]
2020
# E501 (line-too-long) is handled by black; suppress here to avoid duplication
2121
ignore = ["E501"]
22+
23+
[tool.commitizen]
24+
name = "cz_customize"
25+
26+
[tool.commitizen.customize]
27+
message_template = "{{change_type}}: {{message}}"
28+
example = "ENH: Add support for Python 3.12"
29+
schema = "<type>: <description>"
30+
schema_pattern = "(BUG|COMP|DOC|ENH|PERF|STYLE): [A-Z].*"
31+
bump_pattern = "^(ENH|BUG|COMP|PERF)"
32+
bump_map = { "ENH" = "MINOR", "BUG" = "PATCH", "COMP" = "PATCH", "PERF" = "PATCH" }
33+
commit_parser = "^(?P<change_type>BUG|COMP|DOC|ENH|PERF|STYLE): (?P<message>.*)"
34+
changelog_pattern = "^(BUG|COMP|DOC|ENH|PERF|STYLE)?(!)?"
35+
change_type_map = { "ENH" = "Enhancements", "BUG" = "Bug Fixes", "COMP" = "Build Fixes", "DOC" = "Documentation", "PERF" = "Performance", "STYLE" = "Style" }
36+
change_type_order = ["Enhancements", "Bug Fixes", "Build Fixes", "Performance", "Documentation", "Style"]
37+
info = """
38+
ITK commit message convention: PREFIX: Description
39+
40+
Valid prefixes:
41+
BUG: a bug fix
42+
COMP: a compilation/build fix
43+
DOC: documentation changes
44+
ENH: new feature or enhancement
45+
PERF: performance improvement
46+
STYLE: code style/formatting (no logic change)
47+
"""
48+
49+
[[tool.commitizen.customize.questions]]
50+
type = "list"
51+
name = "change_type"
52+
message = "Select the type of change:"
53+
choices = [
54+
{ value = "ENH", name = "ENH: A new feature or enhancement", key = "e" },
55+
{ value = "BUG", name = "BUG: A bug fix", key = "b" },
56+
{ value = "COMP", name = "COMP: A compilation/build fix", key = "c" },
57+
{ value = "DOC", name = "DOC: Documentation changes", key = "d" },
58+
{ value = "PERF", name = "PERF: A performance improvement", key = "p" },
59+
{ value = "STYLE", name = "STYLE: Code style/formatting (no logic change)", key = "s" },
60+
]
61+
62+
[[tool.commitizen.customize.questions]]
63+
type = "input"
64+
name = "message"
65+
message = "Commit description (start with capital letter):"

0 commit comments

Comments
 (0)