-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ConventionalCommitsCz): allow to override defaults from config
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 #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 #535.
- Loading branch information
Amit Levy
committed
Aug 3, 2022
1 parent
2ff9f15
commit ed57fab
Showing
8 changed files
with
84 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters