Skip to content

feat: suggest corrected branch name on typo in branch type prefix#391

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/update-commit-checks
Closed

feat: suggest corrected branch name on typo in branch type prefix#391
Copilot wants to merge 2 commits intomainfrom
copilot/update-commit-checks

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

When a branch like bugifx/update-readme fails validation, the "Suggest:" output was a generic format hint with no indication that the type prefix was a typo.

Changes

  • BranchValidator._get_close_match_suggestion() — extracts the prefix before /, runs difflib.get_close_matches against the allowed branch types (cutoff=0.6), and returns a ready-to-run git branch -m <corrected> command when a close match is found
  • BranchValidator._print_branch_failure() — uses the typo-correction suggestion when available; falls back to the static catalog suggest otherwise
  • Moved difflib and _print_failure to module-level imports

Example

Before:

Suggest: Use <type>/<description> with allowed types or add branch name to allow_branch_names in config...

After (bugifx/update-readme):

Suggest: git branch -m bugfix/update-readme

Branches with no close match (e.g. xyz/branch) continue to show the generic hint.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 4, 2026

Deploy Preview for commit-check ready!

Name Link
🔨 Latest commit b427ab2
🔍 Latest deploy log https://app.netlify.com/projects/commit-check/deploys/69d1a3877897b10008486cdc
😎 Deploy Preview https://deploy-preview-391--commit-check.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@shenxianpeng shenxianpeng force-pushed the copilot/update-commit-checks branch from 9f1d582 to b427ab2 Compare April 4, 2026 23:49
@github-actions github-actions bot added the bug Something isn't working label Apr 4, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 4, 2026

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.26%. Comparing base (eec070a) to head (b427ab2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #391      +/-   ##
==========================================
+ Coverage   95.17%   95.26%   +0.08%     
==========================================
  Files           9        9              
  Lines         892      908      +16     
==========================================
+ Hits          849      865      +16     
  Misses         43       43              

☔ 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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 4, 2026

Merging this PR will improve performance by 53.52%

⚡ 9 improved benchmarks
✅ 193 untouched benchmarks
🆕 4 new benchmarks
⏩ 108 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
test_validate_author_not_in_allowed_list 1.6 ms 1.4 ms +19.56%
test_validate_without_body 1,156.6 µs 876.5 µs +31.96%
test_co_author_not_in_ignore_list_does_not_skip 1,153.7 µs 894.5 µs +28.97%
test_author_name_uses_git_config_when_available 1.7 ms 1.4 ms +17.47%
test_validate_fixup_commit_not_allowed 1.4 ms 1.1 ms +23.41%
test_validate_merge_commit_not_allowed 1.4 ms 1.1 ms +24.12%
🆕 test_get_close_match_suggestion_typo N/A 254.9 µs N/A
🆕 test_get_close_match_suggestion_no_slash N/A 119.2 µs N/A
test_validate_without_signoff 809.3 µs 527.1 µs +53.52%
🆕 test_branch_validator_typo_shows_correction N/A 1.4 ms N/A
🆕 test_get_close_match_suggestion_no_close_match N/A 171 µs N/A
test_validate_with_non_imperative_subject 1,163.4 µs 885.7 µs +31.35%
test_validate_all_mixed_results 1.4 ms 1.1 ms +24.21%

Comparing copilot/update-commit-checks (b427ab2) with main (5877170)2

Open in CodSpeed

Footnotes

  1. 108 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (eec070a) during the generation of this report, so 5877170 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@shenxianpeng shenxianpeng deleted the copilot/update-commit-checks branch April 5, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants