Skip to content

Conversation

@bearomorphism
Copy link
Contributor

@bearomorphism bearomorphism commented Nov 22, 2025

Description

Fixed the behavior of --major and --minor. Added tests.

Before this PR

cz version --major
# 4.10.0

After this PR

cz version --major
# Output errors about wrong usage of `cz version`

Also added the expected usage for --major and --minor options.

Checklist

Code Changes

  • Add test cases to all the changes you introduce
  • Run poetry all locally to ensure this change passes linter check and tests

@codecov
Copy link

codecov bot commented Nov 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (v4-10-1@d53fb20). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             v4-10-1    #1673   +/-   ##
==========================================
  Coverage           ?   98.67%           
==========================================
  Files              ?       60           
  Lines              ?     2649           
  Branches           ?        0           
==========================================
  Hits               ?     2614           
  Misses             ?       35           
  Partials           ?        0           
Flag Coverage Δ
unittests 98.67% <100.00%> (?)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bearomorphism bearomorphism marked this pull request as draft November 22, 2025 12:19
@bearomorphism bearomorphism force-pushed the fix-version-major-minor branch from 5229525 to 8f6491b Compare November 22, 2025 12:51
@bearomorphism bearomorphism marked this pull request as ready for review November 22, 2025 12:52
@bearomorphism bearomorphism force-pushed the fix-version-major-minor branch from 8f6491b to d05067c Compare November 22, 2025 12:54
@woile
Copy link
Member

woile commented Nov 26, 2025

Shouldn't this scenario fail? cz version gives the version of cz itself not the project.
I was not sure what to do myself.

But the way I was picturing it was:

how to work with the project's version?

which translates to cz version --project or cz version -p.

I think users would want to work withe the project's version, if you want your project's next version: cz version -p --next, or your project's current version: cz version -p --major.

By allowing cz version --major I think we may be creating confusion for the users. It becomes easier to shoot yourself in the foot, don't you think? I don't see a use case for cz version --major really.
I'm inclined for failing, until we have a concrete reason for cz version --major

I agree that right now it's a bogus scenario:
cz version --major returns a wrong value

@bearomorphism
Copy link
Contributor Author

Sounds good, then I will make it fail in the next iteration.
I created this patch because I was playing with cz version and I found the behavior of cz version --major strange, at least I thought it should not output the full version of commitizen itself.

Failing the command sounds better

@bearomorphism
Copy link
Contributor Author

How about showing the help of cz version if there are unexpected combination of parameters? I am not sure if there is a clean way to do it.

@bearomorphism bearomorphism force-pushed the fix-version-major-minor branch 2 times, most recently from 6e9cfaa to cb92f16 Compare November 26, 2025 17:18
Copy link
Member

@woile woile left a comment

Choose a reason for hiding this comment

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

LGTM

@bearomorphism bearomorphism force-pushed the fix-version-major-minor branch from cb92f16 to 40b2251 Compare November 26, 2025 17:30
@bearomorphism
Copy link
Contributor Author

bearomorphism commented Nov 26, 2025

I moved the no argument cz version logic back to the end of __call__... reordering those was not a smart decision, that makes us hard to augment the command

@Lee-W
Copy link
Member

Lee-W commented Nov 30, 2025

I just rebase the v4-10-1 with the latest changes. Could you please rebase from v4-10-1? Thanks!

@bearomorphism
Copy link
Contributor Author

Also updated PR description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants