Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate defaults for cz_customize pyproject.toml #535

Open
willjhenry opened this issue Jul 5, 2022 · 9 comments · May be fixed by #546
Open

generate defaults for cz_customize pyproject.toml #535

willjhenry opened this issue Jul 5, 2022 · 9 comments · May be fixed by #546
Labels
type: feature A new enhacement proposal

Comments

@willjhenry
Copy link

Description

I want to add a type but, in order to do so, I need to define the entire commitizen sections of my pyproject.toml as outlined here: https://commitizen-tools.github.io/commitizen/customization/.

It would be much easier to have the option to start with the defaults filled in (e.g. default questions, default message_template,etc...) and then modify from there. As it is now, I am copying values out of the ConventionalCommitsCz

Possible Solution

No response

Additional context

No response

Additional context

No response

@willjhenry willjhenry added the type: feature A new enhacement proposal label Jul 5, 2022
@Lee-W
Copy link
Member

Lee-W commented Jul 22, 2022

What's in my mind was making cz_conventional_commits configurable and deprecate cz_customize? What do you think?

@willjhenry
Copy link
Author

willjhenry commented Jul 22, 2022 via email

@willjhenry
Copy link
Author

willjhenry commented Jul 22, 2022 via email

@Lee-W
Copy link
Member

Lee-W commented Jul 22, 2022

either way works for me. 🙂 we're kinda out of bandwidth these days. would be great if you're interested in sending a PR

@amitlevy21
Copy link

@Lee-W Hi, I would like to try and open a PR making cz_conventional_commits read from config and then fallback to defaults, allowing extensibility without the need to specify all configuration for cz_customize if we just want to override small behavior. Is that ok from your side?

amitlevy21 pushed a commit to amitlevy21/commitizen that referenced this issue Aug 3, 2022
Before fixing tests and adding extra ones, I would like to received
partial feedback about my changes to see if this aligns with the desired
code changes by maintainers.

As addressed on commitizen-tools#535, when using customize commitizen, if we want to
customize a small attribute, we need to redefine all commitizens options
to make our custom class work.

For example:

```suggestion
diff --git a/cz.yaml b/cz.yaml
index 2e847b0..302e961 100644
--- a/cz.yaml
+++ b/cz.yaml
@@ -1,17 +1,18 @@
 commitizen:
   annotated_tag: true
   bump_message: 'bump: $current_version -> $new_version [skip ci]'
-  bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
-  bump_map:
-    fix: PATCH
-    feat: PATCH
-    docs: PATCH
-    style: PATCH
-    refactor: PATCH
-    test: PATCH
-    build: PATCH
-    ci: PATCH
-
-  name: cz_conventional_commits
+  name: cz_customize
   update_changelog_on_bump: true
   version: 0.11.0
+
+  customize:
+    bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
+    bump_map:
+      fix: PATCH
+      feat: PATCH
+      docs: PATCH
+      style: PATCH
+      refactor: PATCH
+      test: PATCH
+      build: PATCH
+      ci: PATCH
```

making the following change on a repo would cause an unexpected
behavior:

```python
+ bash -c cz commit

Traceback (most recent call last):
  File "/home/amit/.local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/cli.py", line 382, in main
    args.func(conf, vars(args))()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 74, in __call__
    m = self.prompt_commit_questions()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in prompt_commit_questions
    for question in filter(lambda q: q["type"] == "list", questions):
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in <lambda>
    for question in filter(lambda q: q["type"] == "list", questions):
KeyError: 'type'
```

From my best understanding, this error happens because I didn't defined
question section in config, though I'm ok with using
ConventionalCommitsCz default ones.

This commit extends ConventionalCommitsCz to read from config and
fallbacks to defaults if some are not provided.

By adding this change, potentially customize commitizen can be
deprecated.

Closes commitizen-tools#535.
amitlevy21 pushed a commit to amitlevy21/commitizen that referenced this issue Aug 3, 2022
Before fixing tests and adding extra ones, I would like to received
partial feedback about my changes to see if this aligns with the desired
code changes by maintainers.

As addressed on commitizen-tools#535, when using customize commitizen, if we want to
customize a small attribute, we need to redefine all commitizens options
to make our custom class work.

For example:

```diff
diff --git a/cz.yaml b/cz.yaml
index 2e847b0..302e961 100644
--- a/cz.yaml
+++ b/cz.yaml
@@ -1,17 +1,18 @@
 commitizen:
   annotated_tag: true
   bump_message: 'bump: $current_version -> $new_version [skip ci]'
-  bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
-  bump_map:
-    fix: PATCH
-    feat: PATCH
-    docs: PATCH
-    style: PATCH
-    refactor: PATCH
-    test: PATCH
-    build: PATCH
-    ci: PATCH
-
-  name: cz_conventional_commits
+  name: cz_customize
   update_changelog_on_bump: true
   version: 0.11.0
+
+  customize:
+    bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
+    bump_map:
+      fix: PATCH
+      feat: PATCH
+      docs: PATCH
+      style: PATCH
+      refactor: PATCH
+      test: PATCH
+      build: PATCH
+      ci: PATCH
```

making the following change on a repo would cause an unexpected
behavior:

```python
+ bash -c cz commit

Traceback (most recent call last):
  File "/home/amit/.local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/cli.py", line 382, in main
    args.func(conf, vars(args))()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 74, in __call__
    m = self.prompt_commit_questions()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in prompt_commit_questions
    for question in filter(lambda q: q["type"] == "list", questions):
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in <lambda>
    for question in filter(lambda q: q["type"] == "list", questions):
KeyError: 'type'
```

From my best understanding, this error happens because I didn't defined
question section in config, though I'm ok with using
ConventionalCommitsCz default ones.

This commit extends ConventionalCommitsCz to read from config and
fallbacks to defaults if some are not provided.

By adding this change, potentially customize commitizen can be
deprecated.

Closes commitizen-tools#535.
amitlevy21 pushed a commit to amitlevy21/commitizen that referenced this issue Aug 3, 2022
Before fixing tests and adding extra ones, I would like to received
partial feedback about my changes to see if this aligns with the desired
code changes by maintainers.

As addressed on commitizen-tools#535, when using customize commitizen, if we want to
customize a small attribute, we need to redefine all commitizens options
to make our custom class work.

For example:

```diff
diff --git a/cz.yaml b/cz.yaml
index 2e847b0..302e961 100644
--- a/cz.yaml
+++ b/cz.yaml
@@ -1,17 +1,18 @@
 commitizen:
   annotated_tag: true
   bump_message: 'bump: $current_version -> $new_version [skip ci]'
-  bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
-  bump_map:
-    fix: PATCH
-    feat: PATCH
-    docs: PATCH
-    style: PATCH
-    refactor: PATCH
-    test: PATCH
-    build: PATCH
-    ci: PATCH
-
-  name: cz_conventional_commits
+  name: cz_customize
   update_changelog_on_bump: true
   version: 0.11.0
+
+  customize:
+    bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
+    bump_map:
+      fix: PATCH
+      feat: PATCH
+      docs: PATCH
+      style: PATCH
+      refactor: PATCH
+      test: PATCH
+      build: PATCH
+      ci: PATCH
```

making the following change on a repo would cause an unexpected
behavior:

```python
+ bash -c cz commit

Traceback (most recent call last):
  File "/home/amit/.local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/cli.py", line 382, in main
    args.func(conf, vars(args))()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 74, in __call__
    m = self.prompt_commit_questions()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in prompt_commit_questions
    for question in filter(lambda q: q["type"] == "list", questions):
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in <lambda>
    for question in filter(lambda q: q["type"] == "list", questions):
KeyError: 'type'
```

From my best understanding, this error happens because I didn't defined
question section in config, though I'm ok with using
ConventionalCommitsCz default ones.

This commit extends ConventionalCommitsCz to read from config and
fallbacks to defaults if some are not provided.

By adding this change, potentially customize commitizen can be
deprecated.

BREAKING CHANGES: CustomizeCommitsCz was removed.

Closes commitizen-tools#535.
amitlevy21 pushed a commit to amitlevy21/commitizen that referenced this issue Aug 3, 2022
Before fixing tests and adding extra ones, I would like to received
partial feedback about my changes to see if this aligns with the desired
code changes by maintainers.

As addressed on commitizen-tools#535, when using customize commitizen, if we want to
customize a small attribute, we need to redefine all commitizens options
to make our custom class work.

For example:

```diff
diff --git a/cz.yaml b/cz.yaml
index f2e19a9..302e961 100644
--- a/cz.yaml
+++ b/cz.yaml
@@ -1,6 +1,18 @@
 commitizen:
   annotated_tag: true
   bump_message: 'bump: $current_version -> $new_version [skip ci]'
-  name: cz_conventional_commits
+  name: cz_customize
   update_changelog_on_bump: true
   version: 0.11.0
+
+  customize:
+    bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
+    bump_map:
+      fix: PATCH
+      feat: PATCH
+      docs: PATCH
+      style: PATCH
+      refactor: PATCH
+      test: PATCH
+      build: PATCH
+      ci: PATCH
diff --git a/t b/t
new file mode 100644
index 0000000..e69de29
diff --git a/t2 b/t2
new file mode 100644
index 0000000..e69de29
```

making the following change on a repo would cause an unexpected
behavior:

```python
+ bash -c cz commit

Traceback (most recent call last):
  File "/home/amit/.local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/cli.py", line 382, in main
    args.func(conf, vars(args))()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 74, in __call__
    m = self.prompt_commit_questions()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in prompt_commit_questions
    for question in filter(lambda q: q["type"] == "list", questions):
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in <lambda>
    for question in filter(lambda q: q["type"] == "list", questions):
KeyError: 'type'
```

From my best understanding, this error happens because I didn't defined
question section in config, though I'm ok with using
ConventionalCommitsCz default ones.

This commit extends ConventionalCommitsCz to read from config and
fallbacks to defaults if some are not provided.

By adding this change, potentially customize commitizen can be
deprecated.

BREAKING CHANGES: CustomizeCommitsCz was removed.

Closes commitizen-tools#535.
@amitlevy21
Copy link

@Lee-W I took the initiative and opened a PR. Hope it's ok and curios to hear your thoughts

@Lee-W
Copy link
Member

Lee-W commented Aug 4, 2022

Thanks @amitlevy21 . Will take a deeper look these days!

amitlevy21 pushed a commit to amitlevy21/commitizen that referenced this issue Aug 9, 2022
Before fixing tests and adding extra ones, I would like to received
partial feedback about my changes to see if this aligns with the desired
code changes by maintainers.

As addressed on commitizen-tools#535, when using customize commitizen, if we want to
customize a small attribute, we need to redefine all commitizens options
to make our custom class work.

For example:

```diff
diff --git a/cz.yaml b/cz.yaml
index f2e19a9..302e961 100644
--- a/cz.yaml
+++ b/cz.yaml
@@ -1,6 +1,18 @@
 commitizen:
   annotated_tag: true
   bump_message: 'bump: $current_version -> $new_version [skip ci]'
-  name: cz_conventional_commits
+  name: cz_customize
   update_changelog_on_bump: true
   version: 0.11.0
+
+  customize:
+    bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
+    bump_map:
+      fix: PATCH
+      feat: PATCH
+      docs: PATCH
+      style: PATCH
+      refactor: PATCH
+      test: PATCH
+      build: PATCH
+      ci: PATCH
diff --git a/t b/t
new file mode 100644
index 0000000..e69de29
diff --git a/t2 b/t2
new file mode 100644
index 0000000..e69de29
```

making the following change on a repo would cause an unexpected
behavior:

```python
+ bash -c cz commit

Traceback (most recent call last):
  File "/home/amit/.local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/cli.py", line 382, in main
    args.func(conf, vars(args))()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 74, in __call__
    m = self.prompt_commit_questions()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in prompt_commit_questions
    for question in filter(lambda q: q["type"] == "list", questions):
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in <lambda>
    for question in filter(lambda q: q["type"] == "list", questions):
KeyError: 'type'
```

From my best understanding, this error happens because I didn't defined
question section in config, though I'm ok with using
ConventionalCommitsCz default ones.

This commit extends ConventionalCommitsCz to read from config and
fallbacks to defaults if some are not provided.

By adding this change, potentially customize commitizen can be
deprecated.

BREAKING CHANGES: CustomizeCommitsCz was removed.

Closes commitizen-tools#535.
amitlevy21 pushed a commit to amitlevy21/commitizen that referenced this issue Aug 9, 2022
As addressed on commitizen-tools#535, when using customize commitizen, if we want to
customize a small attribute, we need to redefine all commitizens options
to make our custom class work.

For example:

```diff
diff --git a/cz.yaml b/cz.yaml
index f2e19a9..302e961 100644
--- a/cz.yaml
+++ b/cz.yaml
@@ -1,6 +1,18 @@
 commitizen:
   annotated_tag: true
   bump_message: 'bump: $current_version -> $new_version [skip ci]'
-  name: cz_conventional_commits
+  name: cz_customize
   update_changelog_on_bump: true
   version: 0.11.0
+
+  customize:
+    bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
+    bump_map:
+      fix: PATCH
+      feat: PATCH
+      docs: PATCH
+      style: PATCH
+      refactor: PATCH
+      test: PATCH
+      build: PATCH
+      ci: PATCH
diff --git a/t b/t
new file mode 100644
index 0000000..e69de29
diff --git a/t2 b/t2
new file mode 100644
index 0000000..e69de29
```

making the following change on a repo would cause an unexpected
behavior:

```python
+ bash -c cz commit

Traceback (most recent call last):
  File "/home/amit/.local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/cli.py", line 382, in main
    args.func(conf, vars(args))()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 74, in __call__
    m = self.prompt_commit_questions()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in prompt_commit_questions
    for question in filter(lambda q: q["type"] == "list", questions):
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in <lambda>
    for question in filter(lambda q: q["type"] == "list", questions):
KeyError: 'type'
```

From my best understanding, this error happens because I didn't defined
question section in config, though I'm ok with using
ConventionalCommitsCz default ones.

This commit extends ConventionalCommitsCz to read from config and
fallbacks to defaults if some are not provided.

By adding this change, potentially customize commitizen can be
deprecated.

Closes commitizen-tools#535.
amitlevy21 pushed a commit to amitlevy21/commitizen that referenced this issue Aug 9, 2022
As addressed on commitizen-tools#535, when using customize commitizen, if we want to
customize a small attribute, we need to redefine all commitizens options
to make our custom class work.

For example:

```diff
diff --git a/cz.yaml b/cz.yaml
index f2e19a9..302e961 100644
--- a/cz.yaml
+++ b/cz.yaml
@@ -1,6 +1,18 @@
 commitizen:
   annotated_tag: true
   bump_message: 'bump: $current_version -> $new_version [skip ci]'
-  name: cz_conventional_commits
+  name: cz_customize
   update_changelog_on_bump: true
   version: 0.11.0
+
+  customize:
+    bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
+    bump_map:
+      fix: PATCH
+      feat: PATCH
+      docs: PATCH
+      style: PATCH
+      refactor: PATCH
+      test: PATCH
+      build: PATCH
+      ci: PATCH
diff --git a/t b/t
new file mode 100644
index 0000000..e69de29
diff --git a/t2 b/t2
new file mode 100644
index 0000000..e69de29
```

making the following change on a repo would cause an unexpected
behavior:

```python
+ bash -c cz commit

Traceback (most recent call last):
  File "/home/amit/.local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/cli.py", line 382, in main
    args.func(conf, vars(args))()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 74, in __call__
    m = self.prompt_commit_questions()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in prompt_commit_questions
    for question in filter(lambda q: q["type"] == "list", questions):
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in <lambda>
    for question in filter(lambda q: q["type"] == "list", questions):
KeyError: 'type'
```

From my best understanding, this error happens because I didn't defined
question section in config, though I'm ok with using
ConventionalCommitsCz default ones.

This commit extends ConventionalCommitsCz to read from config and
fallbacks to defaults if some are not provided.

By adding this change, potentially customize commitizen can be
deprecated.

Closes commitizen-tools#535.
amitlevy21 pushed a commit to amitlevy21/commitizen that referenced this issue Aug 9, 2022
As addressed on commitizen-tools#535, when using customize commitizen, if we want to
customize a small attribute, we need to redefine all commitizens options
to make our custom class work.

For example:

```diff
diff --git a/cz.yaml b/cz.yaml
index f2e19a9..302e961 100644
--- a/cz.yaml
+++ b/cz.yaml
@@ -1,6 +1,18 @@
 commitizen:
   annotated_tag: true
   bump_message: 'bump: $current_version -> $new_version [skip ci]'
-  name: cz_conventional_commits
+  name: cz_customize
   update_changelog_on_bump: true
   version: 0.11.0
+
+  customize:
+    bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
+    bump_map:
+      fix: PATCH
+      feat: PATCH
+      docs: PATCH
+      style: PATCH
+      refactor: PATCH
+      test: PATCH
+      build: PATCH
+      ci: PATCH
diff --git a/t b/t
new file mode 100644
index 0000000..e69de29
diff --git a/t2 b/t2
new file mode 100644
index 0000000..e69de29
```

making the following change on a repo would cause an unexpected
behavior:

```python
+ bash -c cz commit

Traceback (most recent call last):
  File "/home/amit/.local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/cli.py", line 382, in main
    args.func(conf, vars(args))()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 74, in __call__
    m = self.prompt_commit_questions()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in prompt_commit_questions
    for question in filter(lambda q: q["type"] == "list", questions):
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in <lambda>
    for question in filter(lambda q: q["type"] == "list", questions):
KeyError: 'type'
```

From my best understanding, this error happens because I didn't defined
question section in config, though I'm ok with using
ConventionalCommitsCz default ones.

This commit extends ConventionalCommitsCz to read from config and
fallbacks to defaults if some are not provided.

By adding this change, potentially customize commitizen can be
deprecated.

Closes commitizen-tools#535.
amitlevy21 pushed a commit to amitlevy21/commitizen that referenced this issue Aug 31, 2022
As addressed on commitizen-tools#535, when using customize commitizen, if we want to
customize a small attribute, we need to redefine all commitizens options
to make our custom class work.

For example:

```diff
diff --git a/cz.yaml b/cz.yaml
index f2e19a9..302e961 100644
--- a/cz.yaml
+++ b/cz.yaml
@@ -1,6 +1,18 @@
 commitizen:
   annotated_tag: true
   bump_message: 'bump: $current_version -> $new_version [skip ci]'
-  name: cz_conventional_commits
+  name: cz_customize
   update_changelog_on_bump: true
   version: 0.11.0
+
+  customize:
+    bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
+    bump_map:
+      fix: PATCH
+      feat: PATCH
+      docs: PATCH
+      style: PATCH
+      refactor: PATCH
+      test: PATCH
+      build: PATCH
+      ci: PATCH
diff --git a/t b/t
new file mode 100644
index 0000000..e69de29
diff --git a/t2 b/t2
new file mode 100644
index 0000000..e69de29
```

making the following change on a repo would cause an unexpected
behavior:

```python
+ bash -c cz commit

Traceback (most recent call last):
  File "/home/amit/.local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/cli.py", line 382, in main
    args.func(conf, vars(args))()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 74, in __call__
    m = self.prompt_commit_questions()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in prompt_commit_questions
    for question in filter(lambda q: q["type"] == "list", questions):
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in <lambda>
    for question in filter(lambda q: q["type"] == "list", questions):
KeyError: 'type'
```

From my best understanding, this error happens because I didn't defined
question section in config, though I'm ok with using
ConventionalCommitsCz default ones.

This commit extends ConventionalCommitsCz to read from config and
fallbacks to defaults if some are not provided.

By adding this change, potentially customize commitizen can be
deprecated.

Closes commitizen-tools#535.
amitlevy21 pushed a commit to amitlevy21/commitizen that referenced this issue Aug 31, 2022
As addressed on commitizen-tools#535, when using customize commitizen, if we want to
customize a small attribute, we need to redefine all commitizens options
to make our custom class work.

For example:

```diff
diff --git a/cz.yaml b/cz.yaml
index f2e19a9..302e961 100644
--- a/cz.yaml
+++ b/cz.yaml
@@ -1,6 +1,18 @@
 commitizen:
   annotated_tag: true
   bump_message: 'bump: $current_version -> $new_version [skip ci]'
-  name: cz_conventional_commits
+  name: cz_customize
   update_changelog_on_bump: true
   version: 0.11.0
+
+  customize:
+    bump_pattern: '^(fix|feat|docs|style|refactor|test|build|ci)'
+    bump_map:
+      fix: PATCH
+      feat: PATCH
+      docs: PATCH
+      style: PATCH
+      refactor: PATCH
+      test: PATCH
+      build: PATCH
+      ci: PATCH
diff --git a/t b/t
new file mode 100644
index 0000000..e69de29
diff --git a/t2 b/t2
new file mode 100644
index 0000000..e69de29
```

making the following change on a repo would cause an unexpected
behavior:

```python
+ bash -c cz commit

Traceback (most recent call last):
  File "/home/amit/.local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/cli.py", line 382, in main
    args.func(conf, vars(args))()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 74, in __call__
    m = self.prompt_commit_questions()
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in prompt_commit_questions
    for question in filter(lambda q: q["type"] == "list", questions):
  File "/home/amit/.local/lib/python3.10/site-packages/commitizen/commands/commit.py", line 49, in <lambda>
    for question in filter(lambda q: q["type"] == "list", questions):
KeyError: 'type'
```

From my best understanding, this error happens because I didn't defined
question section in config, though I'm ok with using
ConventionalCommitsCz default ones.

This commit extends ConventionalCommitsCz to read from config and
fallbacks to defaults if some are not provided.

By adding this change, potentially customize commitizen can be
deprecated.

Closes commitizen-tools#535.
@shantonio
Copy link

shantonio commented Jun 26, 2023

@Lee-W @amitlevy21
any updates to use cz_customize with default parser ?

@Lee-W
Copy link
Member

Lee-W commented Jun 27, 2023

No update at this moment. Would appreciate it if anyone wants to take a look 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A new enhacement proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants