Skip to content

Commit 86e9ebf

Browse files
committed
chore: configuration commitizen pour check des commits et commit via cz
1 parent d14882b commit 86e9ebf

1 file changed

Lines changed: 60 additions & 2 deletions

File tree

.cz.toml

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,66 @@ version_files = [
1010
"package.json:version"
1111
]
1212
pre_bump_hooks = "npx task build"
13+
use_shortcuts = true
1314
[tool.commitizen.customize]
14-
message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}"
15+
message_template = "{{change_type}}{% if scope %}({{scope}}){% endif %}{% if breaking %}!{% endif %}: {{message}}"
1516
commit_parser = '^((?P<change_type>feat|fix|refactor|perf|style|test|ci|build|doc|docs|chore|BREAKING CHANGE)(?:\((?P<scope>[^()\r\n]*)\)|\()?(?P<breaking>!)?|\w+!):\s(?P<message>.*)?'
1617
change_type_order = ["BREAKING CHANGE", "Feat", "Fix", "refactor", "perf", "test", "style", "doc", "docs", "CI", "Build", "Chore"]
17-
change_type_map = {"feat"= "Feat","fix"= "Fix","refactor"= "Refactor","perf"= "Perf","chore"= "Chore", "ci" = "CI", "build" = "Build", "style" = "Style", "doc" = "Docs", "docs" = "Docs", "test" = "Test"}
18+
change_type_map = {"feat"= "Feat","fix"= "Fix","refactor"= "Refactor","perf"= "Perf","chore"= "Chore", "ci" = "CI", "build" = "Build", "style" = "Style", "doc" = "Docs", "docs" = "Docs", "test" = "Test"}
19+
schema_pattern = '''(?x) # mode verbose
20+
( # Type group
21+
(fix|feat)\([^)]+\) # fix(...) or feat(...) → scope obligatoire
22+
| # ou
23+
(?!fix|feat)(build|ci|docs|perf|refactor|style|test|chore|revert|bump|edit)(\(\S+\))? # autres → scope facultatif
24+
)
25+
!? # optionnel breaking change "!"
26+
:\s # le ":" suivi d'un espace obligatoire
27+
[^\n\r]+ # message sur la même ligne
28+
(?:\n\n.*)? # optionnel : paragraphe de body
29+
$
30+
'''
31+
types = [
32+
{ type = "feat", description = "A new feature" },
33+
{ type = "fix", description = "A bug fix" },
34+
{ type = "edit", description = "Internal change (not in changelog)" },
35+
{ type = "docs", description = "Documentation only changes" },
36+
{ type = "refactor", description = "Code changes without bug fix or feature" },
37+
{ type = "test", description = "Add or fix tests" },
38+
{ type = "chore", description = "Other changes" }
39+
]
40+
41+
[[tool.commitizen.customize.questions]]
42+
43+
type = "list"
44+
name = "change_type"
45+
message = "Select the type of change you are committing"
46+
choices = [
47+
{ value = "fix", name = "fix: A bug fix. Correlates with PATCH in SemVer", key = "x" },
48+
{ value = "feat", name = "feat: A new feature. Correlates with MINOR in SemVer", key = "f" },
49+
{ value = "docs", name = "docs: Documentation only changes", key = "d" },
50+
{ value = "style", name = "style: Changes that do not affect code meaning", key = "s" },
51+
{ value = "refactor", name = "refactor: A code change that neither fixes a bug nor adds a feature", key = "r" },
52+
{ value = "perf", name = "perf: A code change that improves performance", key = "p" },
53+
{ value = "test", name = "test: Adding missing or correcting existing tests", key = "t" },
54+
{ value = "build", name = "build: Changes that affect the build system or external dependencies", key = "b" },
55+
{ value = "ci", name = "ci: Changes to CI configuration files and scripts", key = "c" },
56+
{ value = "edit", name = "edit: Internal change (not in changelog)", key = "e" }
57+
]
58+
59+
60+
[[tool.commitizen.customize.questions]]
61+
type = "input"
62+
name = "scope"
63+
message = "What is the scope of this change? (class or file name): (press [enter] to skip)"
64+
65+
66+
[[tool.commitizen.customize.questions]]
67+
type = "input"
68+
name = "message"
69+
message = "Write a short and imperative summary of the code changes: (lower case and no period)"
70+
71+
[[tool.commitizen.customize.questions]]
72+
type = "confirm"
73+
message = "Is this a BREAKING CHANGE? Correlates with MAJOR in SemVer"
74+
name = "breaking"
75+
default = "False"

0 commit comments

Comments
 (0)