Repository navigation
Conversation
A URL cannot be wrapped without breaking it, so a commit message body line that consists only of a URL (optionally written as a Markdown-style link reference such as `[1]: https://...`) no longer triggers the `max_body_width` warning. Lines that mix a URL with other text are still checked as before. Closes sds#822
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
CommitMsg::TextWidthwarns on every body line longer thanmax_body_width, including lines that contain nothing but a URL. A URL can't be wrapped without breaking it (in the terminal and on GitHub), so these warnings can't be fixed without making the message worse.This PR exempts body lines that consist solely of a URL (
scheme://..., surrounding whitespace ignored), optionally written as a Markdown-style link reference such as[1]: https://.... Lines that mix a URL with other text are still checked as before, and the subject line checks are unchanged. No new configuration option is added; the exemption is always on, since an over-long URL-only line is never actionable.Motivation / disclosure: I had some spare AI-assistant quota (Claude Code) and am using it to try to
help projects with open good-first-issues. The change was prepared with Claude Code and verified as listed
below. If it doesn't fit, isn't up to your bar, or you'd simply rather not take it — please feel free to
close it, no hard feelings at all 🙂
Related issue
Closes #822
Checklist
bundle exec rspec spec/overcommit/hook/commit_msg/text_width_spec.rb: 19 examples, 0 failures; the 2 new URL-only specs fail without the fix. Fullbundle exec rspecon Ruby 3.4: 1647 examples, 1 failure (utils_spec.rb:35,repo_rootwith no.gitdirectory), which fails identically onmainin my environment.bundle exec overcommit --run: all pre-commit hooks passed)CHANGELOG.mdis updated (if applicable) — n/a, entries appear to be added when a version is cut; happy to add one if you prefer