Skip to content

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

@codecov
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##             v4-9-2    #1574   +/-   ##
=========================================
  Coverage          ?   98.71%           
=========================================
  Files             ?       60           
  Lines             ?     2655           
  Branches          ?        0           
=========================================
  Hits              ?     2621           
  Misses            ?       34           
  Partials          ?        0           
Flag Coverage Δ
unittests 98.71% <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.

@Lee-W Lee-W added this to the 4.9.0 milestone Aug 12, 2025
@Lee-W Lee-W changed the base branch from master to v4-9-0-test August 12, 2025 06:51
@Narwhal-fish Narwhal-fish reopened this Aug 12, 2025
@Narwhal-fish
Copy link
Author

Sorry, I accidentally closed this pull request.

@Lee-W
Copy link
Member

Lee-W commented Aug 12, 2025

let's rebase from v4-9-test

@Narwhal-fish Narwhal-fish force-pushed the feat/Add-config-option-for-line-length-warning branch from 9a2622f to c300b70 Compare August 12, 2025 17:58
@Narwhal-fish
Copy link
Author

I have rebased my branch onto v4-9-0.
I’m not very familiar with Git, so please let me know if I missed anything.

@Lee-W
Copy link
Member

Lee-W commented Aug 13, 2025

I have rebased my branch onto v4-9-0. I’m not very familiar with Git, so please let me know if I missed anything.

You've done it perfectly 🙂 I'll take a look when bandwidth allow

Copy link
Contributor

@bearomorphism bearomorphism left a comment

Choose a reason for hiding this comment

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

Thanks! A few suggestion:

@Lee-W
Copy link
Member

Lee-W commented Aug 24, 2025

we might need to resolve the conflict first. Thanks!

@Lee-W Lee-W modified the milestones: 4.9.0, 4.10.0 Sep 9, 2025
@Lee-W Lee-W deleted the branch commitizen-tools:v4-9-2 September 9, 2025 06:09
@Lee-W Lee-W closed this Sep 9, 2025
@Lee-W Lee-W reopened this Sep 9, 2025
@Lee-W Lee-W changed the base branch from v4-9-0-test to master September 9, 2025 06:18
@bearomorphism
Copy link
Contributor

Hi @Narwhal-fish , could you help to rebase your branch when you have a moment?

You can run

git fetch upstream
git rebase upstream master -i

and then drop all commits but yours.

@Narwhal-fish Narwhal-fish force-pushed the feat/Add-config-option-for-line-length-warning branch 2 times, most recently from de2e785 to e70271b Compare September 23, 2025 09:13
@Lee-W Lee-W modified the milestones: 4.11.0, 4.10.0 Nov 8, 2025
@Lee-W Lee-W changed the base branch from master to v4-9-2 November 8, 2025 10:11
@Lee-W Lee-W force-pushed the feat/Add-config-option-for-line-length-warning branch from a696b74 to 4adcbba Compare November 8, 2025 10:19
@Lee-W Lee-W force-pushed the feat/Add-config-option-for-line-length-warning branch from 4adcbba to 3f55412 Compare November 8, 2025 10:32
@Lee-W Lee-W merged commit 69d32cf into commitizen-tools:v4-9-2 Nov 8, 2025
18 checks passed
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.

3 participants