Skip to content

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

Closed
RubenSanosh wants to merge 2 commits into
commit-check:mainfrom
RubenSanosh:test/body-validator-edge-cases
Closed

test: add coverage for BodyValidator leading blank line edge cases#491
RubenSanosh wants to merge 2 commits into
commit-check:mainfrom
RubenSanosh:test/body-validator-edge-cases

Conversation

@RubenSanosh

@RubenSanosh RubenSanosh commented Jul 30, 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 coverage for body validation with leading blank lines and whitespace-only input.
    • Verified expected validation behavior for content, blank-line-only, and whitespace-only cases.

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

netlify Bot commented Jul 30, 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/6a6bceae67ca7b0008ee9f00
😎 Deploy Preview https://deploy-preview-491--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 the tests Add test related changes label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f9d01a10-a9f5-4bec-9f9d-01f4e32cbff8

📥 Commits

Reviewing files that changed from the base of the PR and between 56e6e36 and cd4a018.

📒 Files selected for processing (1)
  • tests/engine_test.py

📝 Walkthrough

Walkthrough

Added three BodyValidator tests covering leading blank lines, blank-only input, and whitespace-only messages.

Changes

BodyValidator tests

Layer / File(s) Summary
Validator edge-case coverage
tests/engine_test.py
Tests validate failure for leading blank lines followed by content, and passing results for blank-only or whitespace-only input.

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

Suggested reviewers: shenxianpeng

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the added BodyValidator edge-case tests.
Linked Issues check ✅ Passed The new tests cover the three requested BodyValidator edge cases and match the issue's expected outcomes.
Out of Scope Changes check ✅ Passed The changes stay within the requested test coverage scope and add no unrelated code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 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

@codspeed-hq

codspeed-hq Bot commented Jul 31, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 97.16%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 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:test/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.

@RubenSanosh
RubenSanosh deleted the test/body-validator-edge-cases branch July 31, 2026 04:37
@RubenSanosh
RubenSanosh restored the test/body-validator-edge-cases branch July 31, 2026 04:41
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)

1 participant