-
-
Notifications
You must be signed in to change notification settings - Fork 300
feat: add config option for line length warning #1574
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
base: v4-9-0-test
Are you sure you want to change the base?
feat: add config option for line length warning #1574
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v4-9-0-test #1574 +/- ##
==============================================
Coverage ? 98.09%
==============================================
Files ? 58
Lines ? 2684
Branches ? 0
==============================================
Hits ? 2633
Misses ? 51
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sorry, I accidentally closed this pull request. |
let's rebase from |
9a2622f
to
c300b70
Compare
I have rebased my branch onto v4-9-0. |
You've done it perfectly 🙂 I'll take a look when bandwidth allow |
There was a problem hiding this 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:
commitizen/commands/check.py
Outdated
raise CommitMessageLengthExceededError( | ||
f"commit validation: failed!\n" | ||
f"commit message length exceeds the limit.\n" | ||
f'commit "": "{commit_msg}"\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does ""
mean here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you forgot to put something like commit hash here in the error message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You’re right. I referenced the error handling for invalid messages and forgot to add the commit hash. I’ll make the correction.
commitizen/defaults.py
Outdated
@@ -108,6 +109,7 @@ class Settings(TypedDict, total=False): | |||
"always_signoff": False, | |||
"template": None, # default provided by plugin | |||
"extras": {}, | |||
"message_length_limit": 0, # 0 for no limit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we just use None
for no limit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, I set it to 0 simply because I thought commit messages wouldn't have a 0-character scenario, but your suggestion of using None is more clear. I've made this change accordingly.
…elated logic, types, and tests
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
poetry all
locally to ensure this change passes linter check and testsDocumentation Changes
poetry doc
locally to ensure the documentation pages renders correctlyExpected Behavior
Users can now set default commit message length limits in their configuration file:
Steps to Test This Pull Request
Additional Context