Skip to content

Feat/add config option for line length warning #1575

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

Conversation

Narwhal-fish
Copy link

Description

This PR implements configuration file support for the message_length_limit option, addressing issue #1571 . Previously, users could only set commit message length limits via command-line arguments (-l/--message-length-limit). Now they can define a default limit in their configuration file.

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

Documentation Changes

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

Expected Behavior

Users can now set default commit message length limits in their configuration file:

[tool.commitizen]
message_length_limit = 72

Steps to Test This Pull Request

  1. Test Configuration File Support
# Add the following to your pyproject.toml:
[tool.commitizen]
message_length_limit = 30

# Test with long message (should fail)
cz check -m "fix: this is a very long commit message that exceeds 30 characters"

# Test with short message (should pass)  
cz check -m "fix: short message"
  1. Test CLI Override
# CLI argument should override config setting
cz check -m "fix: this message is longer than 30 chars but shorter than 60" -l 60

# Disable limit with CLI
cz check -m "fix: very long message that would normally fail config limit" -l 0

Additional Context

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