Skip to content

Feat: Validate message_length_limit is non-negative#1908

Open
ttw225 wants to merge 11 commits intocommitizen-tools:masterfrom
ttw225:feat/validate-message-length-limit
Open

Feat: Validate message_length_limit is non-negative#1908
ttw225 wants to merge 11 commits intocommitizen-tools:masterfrom
ttw225:feat/validate-message-length-limit

Conversation

@ttw225
Copy link
Contributor

@ttw225 ttw225 commented Mar 20, 2026

Description

Added validation for message_length_limit coming from either CLI or config: it must be a non-negative integer (>= 0). Negative values raise InvalidCommandArgumentError.

This PR was rebased from #1900 , focusing on the message_length_limit >= 0 validation behavior.

Checklist

Was generative AI tooling used to co-author this PR?

  • Yes (please specify the tool below)

Co-generated-by: [Cursor] following the guidelines

Code Changes

  • Add test cases to all the changes you introduce
  • Run uv run poe 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

Documentation Changes

  • Run uv run poe doc locally to ensure the documentation pages renders correctly
  • Check and fix any broken links (internal or external)

Expected Behavior

--message-length-limit -1 or message_length_limit = -1 in config results in an error (InvalidCommandArgumentError).

Steps to Test This Pull Request

  • cz check -l -1 --message "feat: hello"
  • cz commit -l -1

Additional Context

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.99%. Comparing base (33223b4) to head (f2ac1c1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1908   +/-   ##
=======================================
  Coverage   97.99%   97.99%           
=======================================
  Files          60       60           
  Lines        2689     2695    +6     
=======================================
+ Hits         2635     2641    +6     
  Misses         54       54           

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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant