Skip to content

test: add cases for BodyValidator leading blank line edge cases - #492

Merged
shenxianpeng merged 2 commits into
commit-check:mainfrom
RubenSanosh:chore/body-validator-edge-cases
Jul 31, 2026
Merged

test: add cases for BodyValidator leading blank line edge cases#492
shenxianpeng merged 2 commits into
commit-check:mainfrom
RubenSanosh:chore/body-validator-edge-cases

Conversation

@RubenSanosh

@RubenSanosh RubenSanosh commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Closes #490

Added 3 test cases to TestBodyValidator covering leading-blank-line and
whitespace-only commit messages, matching the corrected expected results
in the updated issue description.

Note: lines 556-558 in BodyValidator.validate() still show as uncovered.
I believe this branch is unreachable in practice, since _get_commit_message()
strips the message before validate() runs, a message can never have
content on the first line followed by surviving blank lines by the time
it reaches this check. Happy to look into removing that dead code in a
follow up if useful, just flagging it here for visibility.

Summary by CodeRabbit

  • Tests
    • Added regression coverage for handling leading blank lines and whitespace-only messages.
    • Verified that empty or whitespace-only input is accepted, while improperly formatted body content is rejected.

@RubenSanosh
RubenSanosh requested a review from a team as a code owner July 31, 2026 04:42
@RubenSanosh
RubenSanosh requested review from shenxianpeng and removed request for a team July 31, 2026 04:42
@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for commit-check ready!

Name Link
🔨 Latest commit cd4a018
🔍 Latest deploy log https://app.netlify.com/projects/commit-check/deploys/6a6c27bd0fe8130008ddeb67
😎 Deploy Preview https://deploy-preview-492--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.

@github-actions github-actions Bot added chore tests Add test related changes labels Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds BodyValidator regression tests for leading blank lines and whitespace-only messages. The tests verify that stripped body content fails without a subject, while empty-after-stripping messages pass.

Changes

BodyValidator test coverage

Layer / File(s) Summary
Leading-blank and whitespace-only cases
tests/engine_test.py
Adds tests for body content after leading blank lines, blank-only input, and whitespace-only input.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: shenxianpeng

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The tests satisfy issue #490 by covering all three specified BodyValidator edge cases and expected outcomes.
Out of Scope Changes check ✅ Passed The pull request only adds BodyValidator regression tests related to issue #490.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the added BodyValidator tests for leading blank line edge cases.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.36%. Comparing base (56e6e36) to head (cd4a018).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #492      +/-   ##
==========================================
+ Coverage   97.19%   97.36%   +0.17%     
==========================================
  Files          12       12              
  Lines        1175     1175              
==========================================
+ Hits         1142     1144       +2     
+ Misses         33       31       -2     

☔ View full report in Codecov by Harness.
📢 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.

@shenxianpeng shenxianpeng changed the title Chore/body validator edge cases test: add coverage for BodyValidator leading blank line edge cases Jul 31, 2026
@shenxianpeng

shenxianpeng commented Jul 31, 2026

Copy link
Copy Markdown
Member

Thanks for your PR!

@codspeed-hq

codspeed-hq Bot commented Jul 31, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 97.16%

⚡ 1 improved benchmark
✅ 380 untouched benchmarks
🆕 3 new benchmarks
⏩ 115 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
test_empty_message_passes 1,475.5 µs 748.4 µs +97.16%
🆕 test_validate_with_leading_blank_lines_and_body N/A 815.7 µs N/A
🆕 test_validate_with_leading_blank_lines_no_body N/A 129.3 µs N/A
🆕 test_validate_with_whitespace_only_message N/A 130.1 µs N/A

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing RubenSanosh:chore/body-validator-edge-cases (cd4a018) with main (56e6e36)

Open in CodSpeed

Footnotes

  1. 115 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.

@shenxianpeng shenxianpeng changed the title test: add coverage for BodyValidator leading blank line edge cases test: add cases for BodyValidator leading blank line edge cases Jul 31, 2026
@shenxianpeng
shenxianpeng merged commit 3095509 into commit-check:main Jul 31, 2026
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Add test related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test coverage for BodyValidator edge cases (empty/leading-blank messages)

2 participants