Skip to content

fix(ExitCode): add from_str in ExitCode and replace parse_no_raise with it, warn if the error code is not in range #1545

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

Open
wants to merge 1 commit into
base: v4-9-0-test
Choose a base branch
from

Conversation

bearomorphism
Copy link
Contributor

@bearomorphism bearomorphism commented Jun 12, 2025

Description

  • Now we validate if the error code exists given a decimal string

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
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
    • Test edge cases and error conditions
    • Ensure backward compatibility is maintained
    • Document any manual testing steps performed
  • Update the documentation for the changes

@bearomorphism bearomorphism changed the base branch from master to v4-9-0-test June 12, 2025 14:22
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (v4-9-0-test@6b4f8b0). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff               @@
##             v4-9-0-test    #1545   +/-   ##
==============================================
  Coverage               ?   97.98%           
==============================================
  Files                  ?       58           
  Lines                  ?     2680           
  Branches               ?        0           
==============================================
  Hits                   ?     2626           
  Misses                 ?       54           
  Partials               ?        0           
Flag Coverage Δ
unittests 97.98% <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 ready for review June 12, 2025 14:55
@bearomorphism bearomorphism marked this pull request as draft June 12, 2025 14:56
@bearomorphism bearomorphism force-pushed the no_raise branch 3 times, most recently from 39b824e to 5425115 Compare June 12, 2025 16:14
@bearomorphism bearomorphism marked this pull request as ready for review June 12, 2025 16:15
@bearomorphism bearomorphism changed the title refactor(ExitCode): add from_str in ExitCode and replace parse_no_raise with it fix(ExitCode): add from_str in ExitCode and replace parse_no_raise with it, warn if the error code is not in range Jun 12, 2025
@Lee-W Lee-W added this to the 4.9.0 milestone Jun 13, 2025
if value.isdecimal():
try:
return cls(int(value))
except ValueError:
Copy link
Member

Choose a reason for hiding this comment

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

instead of returning None, I think we should raise error and handles it in commitizen/cli.py instead

Copy link
Member

Choose a reason for hiding this comment

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

I know it might make the code longer, but makes more sense IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

k

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh I misunderstood. I'll fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

…th it

Warn if a given decimal string is not in range
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