Skip to content

Conversation

woile
Copy link
Member

@woile woile commented Apr 25, 2023

Description

It's currently not possible to modify major version zero, meaning that it only works with conventional commits.

If you have a custom rule, and you set major_version_zero to true, it won't find any commits, because it will be actually using the one in defaults.bump_major_version_zero which matches with conventional commit conventions

Checklist

  • Add test cases to all the changes you introduce
  • Run ./scripts/format and ./scripts/test locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

Users should be able to express the behavior when major_version_zero is true, and they have a different set of rules.

woile added 2 commits April 25, 2023 15:58
before this commit, major_version_zero would only work with
conventional commits, as the value used was not exposed to other cz rules
@woile woile requested a review from Lee-W April 25, 2023 14:07
@codecov
Copy link

codecov bot commented Apr 25, 2023

Codecov Report

Patch coverage: 90.90% and project coverage change: -0.05 ⚠️

Comparison is base (1153908) 97.42% compared to head (6096b68) 97.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #726      +/-   ##
==========================================
- Coverage   97.42%   97.38%   -0.05%     
==========================================
  Files          42       42              
  Lines        2022     2029       +7     
==========================================
+ Hits         1970     1976       +6     
- Misses         52       53       +1     
Flag Coverage Δ
unittests 97.38% <90.90%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
commitizen/cz/customize/customize.py 93.84% <75.00%> (-1.24%) ⬇️
commitizen/__version__.py 100.00% <100.00%> (ø)
commitizen/commands/bump.py 98.14% <100.00%> (ø)
commitizen/cz/base.py 100.00% <100.00%> (ø)
...en/cz/conventional_commits/conventional_commits.py 100.00% <100.00%> (ø)
commitizen/defaults.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I'm good with the PR. Just have one minor discussion. But even if we agree on that, we can open an issue and work on that later 🙂

class ConventionalCommitsCz(BaseCommitizen):
bump_pattern = defaults.bump_pattern
bump_map = defaults.bump_map
bump_map_major_version_zero = defaults.bump_map_major_version_zero
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not actually a default for every cz, should we move it out of defaults? I've been thinking for moving these kind of stuff from defaults for a long time but not yet have a chance to do so 🤦‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, many (not all) of those "defaults" are actually part of the conventional commit cz and we are probably creating confusion by having them there

@woile woile merged commit 76ad54f into master Apr 25, 2023
@woile woile deleted the fix/major-version-zero-bump-map branch April 25, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants