feat: limit branch name title to 3 words maximum (#21) #24
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.
Summary
Updates branch name generation to use first 3 meaningful words from issue/PR titles, stripping bracketed prefixes like [Feature], [Bug], [Refactoring]. This creates shorter, more readable branch names while maintaining clear identification.
Changes Made
Code Changes
_generate_branch_name()to strip bracketed prefixes ([Feature],[Bug], etc.)Test Changes
test_generate_branch_name_strips_bracket_prefixes()- Tests various bracket prefix formatstest_generate_branch_name_limits_to_3_words()- Tests 3-word limit enforcementtest_generate_branch_name_short_title_edge_case()- Tests 1-word and 2-word titlestest_generate_branch_name_special_chars_and_case()- Tests sanitization with special charstest_generate_branch_name_pr_format()- Tests PR naming with 3-word limittest_generate_branch_name_no_truncation()- Verifies no 200-char truncation occursDocumentation Updates
Examples
[Feature] Add user authenticationissue-42-feature-add-user-authenticationissue-42-add-user-authentication[Bug] Fix crash on databaseissue-42-bug-fix-crash-on-databaseissue-42-fix-crash-onThis is a very long title with many wordsissue-42-this-is-a-very-long-title...issue-42-this-is-aBenefits
issue-42-fix-dbvsissue-42-fix-database-connection-errorissue-/pr-prefixesTest Results
Note: 2 pre-existing test failures in
test_git_remote_detection.py(unrelated to this PR - test infrastructure issues with directory permissions). All 73 tests related to this PR pass.Code Quality
Acceptance Criteria
issue-{number}-{3-word-title}orpr-{number}-{3-word-title}issue-/pr-prefixes[Feature],[Bug]are strippedCloses #21