Skip to content

test: cover clang-format main entry point - #272

Merged
shenxianpeng merged 1 commit into
cpp-linter:mainfrom
lntutor:chore/266-test-clang-format-main
Aug 1, 2026
Merged

test: cover clang-format main entry point#272
shenxianpeng merged 1 commit into
cpp-linter:mainfrom
lntutor:chore/266-test-clang-format-main

Conversation

@lntutor

@lntutor lntutor commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • cover the successful clang_format.main() path
  • cover failure output and the non-zero return path
  • remove the now-unnecessary coverage exclusions

Tests

uv run pytest tests/test_clang_format.py -q

22 tests passed.

Closes #266

Summary by CodeRabbit

  • Bug Fixes

    • Preserved formatter execution and output behavior while improving coverage tracking for the command-line entry point.
    • The formatter now reliably reports its status and only displays failure output when available.
  • Tests

    • Added coverage for formatter status handling and conditional failure output.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b4349b46-c6ff-4f75-b300-85acb7b5053c

📥 Commits

Reviewing files that changed from the base of the PR and between ae29766 and 0ad2f59.

📒 Files selected for processing (2)
  • cpp_linter_hooks/clang_format.py
  • tests/test_clang_format.py

Walkthrough

The PR removes coverage-exclusion pragmas from main() and adds tests for successful and failed formatter results, including return-code propagation and conditional output.

Changes

clang-format main entry point

Layer / File(s) Summary
Entry-point behavior and tests
cpp_linter_hooks/clang_format.py, tests/test_clang_format.py
main() keeps its existing execution flow without coverage exclusions. Tests cover success with no output and failure with newline-terminated output.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the addition of coverage for the clang-format main entry point.
Linked Issues check ✅ Passed The changes test both success and failure paths of main() and remove its unnecessary coverage exclusions, satisfying issue #266.
Out of Scope Changes check ✅ Passed All changes directly support the linked issue by testing main() and removing obsolete coverage exclusions.

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.

@lntutor

lntutor commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Current head 0ad2f59968d5b5cafa56ddc6253751c1dafa06ee is mergeable, and the current visible checks on this head are green (SonarCloud, CodeRabbit, and pre-commit.ci). There are no unresolved review threads on the current PR state. This looks ready for maintainer review when convenient.

@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.53%. Comparing base (ae29766) to head (0ad2f59).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #272      +/-   ##
==========================================
+ Coverage   97.48%   97.53%   +0.04%     
==========================================
  Files           3        3              
  Lines         239      243       +4     
==========================================
+ Hits          233      237       +4     
  Misses          6        6              

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

@codspeed-hq

codspeed-hq Bot commented Aug 1, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 92 untouched benchmarks
⏩ 54 skipped benchmarks1


Comparing lntutor:chore/266-test-clang-format-main (0ad2f59) with main (ae29766)

Open in CodSpeed

Footnotes

  1. 54 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 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@shenxianpeng shenxianpeng added the tests This PR adds/removes/updates test cases label Aug 1, 2026
@shenxianpeng
shenxianpeng merged commit edd18d9 into cpp-linter:main Aug 1, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests This PR adds/removes/updates test cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a unit test for the clang-format main() entry point

2 participants