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

fix(get-next-bump): fix to permit usage of --get-next option even when update_changelog_on_bump is set to true #1301

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Lowaiz
Copy link

@Lowaiz Lowaiz commented Nov 29, 2024

Description

With the configuration options update_changelog_on_bump set to True, the command cz bump --get-next crashed, due to the mutual exclusive options --get-next and --changelog/--changelog-to-stdout.

Changing this behavior to still throw a conflict when using both CLI options, but let --get-next take the precedence over update_changelog_on_bump configuration.

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

Now the configuration options update_changelog_on_bump can be set to whatever you want when using the cz bump --get-next command.

Steps to Test This Pull Request

  1. Build a commitizen config with update_changelog_on_bump flag set to true.
  2. Add some commits to the target test project.
  3. Run cz bump --get-next
  4. The command should work and not throw an error.

Additional context

Copy link

codecov bot commented Nov 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.55%. Comparing base (120d514) to head (e5d6797).
Report is 505 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1301      +/-   ##
==========================================
+ Coverage   97.33%   97.55%   +0.21%     
==========================================
  Files          42       55      +13     
  Lines        2104     2613     +509     
==========================================
+ Hits         2048     2549     +501     
- Misses         56       64       +8     
Flag Coverage Δ
unittests 97.55% <100.00%> (+0.21%) ⬆️

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.

@Lowaiz Lowaiz changed the title fix(get-next-bump): fix to permit usage of --get-next options even when update_changelog_on_bump is set to true fix(get-next-bump): fix to permit usage of --get-next option even when update_changelog_on_bump is set to true Nov 29, 2024
# Setting dry_run to prevent any unwanted changes to the repo or files
self.dry_run = True
else:
# If user specified changelog_to_stdout, they probably want the
# changelog to be generated as well, this is the most intuitive solution
Copy link
Member

@Lee-W Lee-W Dec 6, 2024

Choose a reason for hiding this comment

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

I'm not so sure about that. If a user wants to print something, they may want to review it first before making any changes.

Copy link
Author

@Lowaiz Lowaiz Dec 9, 2024

Choose a reason for hiding this comment

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

This comment and the associated self.changelog_flag = (self.changelog_flag or bool(self.changelog_to_stdout) or self.changelog_config) is from the L210-L212 of the previous code. (with the inclusion of the new changelog_config change)

Copy link
Author

@Lowaiz Lowaiz Dec 9, 2024

Choose a reason for hiding this comment

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

If a user wants to print something, they may want to review it first before making any changes.

And, from what I understand from the the rest of the bump code, using changelog_to_stdout flag essentially put the changelog generation in dry run. So it will not change any files (my MR doesn't seem to change that behavior I guess).

@Lowaiz Lowaiz requested a review from Lee-W December 11, 2024 09:01
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.

2 participants