GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(junit): count generated test cases by neallin917 · Pull Request #457 · cpplint/cpplint

Conversation

@neallin917

@neallin917 neallin917 commented Jul 31, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Summary

  • count JUnit tests, failures, and errors from the generated test cases instead of individual lint findings
  • update unit and CLI sample expectations for grouped findings
  • document the corrected counts in the changelog

Root cause

FormatJUnitXML() groups all lint findings for a file into one <testcase> with one <failure>, but the suite attributes were calculated from the raw finding lists. JUnit consumers therefore saw many more tests and failures than the XML actually contained.

The suite counts now match the emitted structure: one error testcase when process errors exist, and one failed testcase per file containing lint findings.

Fixes #431

Validation

  • python -m pytest --no-cov cpplint_unittest.py -k testJUnitXML -vv
  • python -m pytest --no-cov 'cpplint_clitest.py::TestNoRepoSignature::test_samples[silly-junit]' -vv
  • python -m pytest — 231 passed, 96.46% coverage
  • python -m pylint cpplint.py
  • python -m mypy cpplint.py cpplint_clitest.py cpplint_unittest.py
  • pre-commit run --all-files
  • git diff --check

AI assistance disclosure

OpenAI Codex was used to investigate the issue, draft the implementation and regression updates, and run the validation commands listed above.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected JUnit XML reports so error counts indicate whether errors occurred.
    • Failure counts now reflect the number of affected files rather than individual failure messages.
    • Test counts now represent distinct generated test cases, preventing inflated totals when multiple messages belong to one case.
    • Updated sample reports and expectations to reflect accurate counts.
  • Documentation

    • Added a changelog entry describing the corrected JUnit failure-count reporting.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@neallin917
fix(junit): count generated test cases
c2a412b
@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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: 52ded4f8-48e3-4f6d-9581-db90b6ce4c17

📥 Commits

Reviewing files that changed from the base of the PR and between c2a412b and b4371d2.

📒 Files selected for processing (3)
  • CHANGELOG.rst
  • cpplint.py
  • cpplint_unittest.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • CHANGELOG.rst
  • cpplint_unittest.py
  • cpplint.py

📝 Walkthrough

Walkthrough

JUnit XML reporting now counts failures by distinct filename. Unit test expectations, sample output, and the changelog reflect the corrected grouped testcase counts.

Changes

JUnit reporting

Layer / File(s) Summary
Correct JUnit count generation
cpplint.py
FormatJUnitXML counts failures by distinct filename while retaining the error-message count.
Update validation and sample output
cpplint_unittest.py, samples/silly-sample/junit.def, CHANGELOG.rst
The test expectation and sample report use two grouped testcases and failures. The changelog records the correction.

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

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 describes the JUnit change to count generated test cases.
Linked Issues check ✅ Passed The changes make JUnit tests and failures reflect testcase elements grouped by file, as required by issue #431.
Out of Scope Changes check ✅ Passed The code, tests, sample output, and changelog changes directly support the JUnit counting requirements in issue #431.
✨ 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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aaronliu0130
aaronliu0130 requested changes Jul 31, 2026
View reviewed changes

@aaronliu0130 aaronliu0130 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I would prefer us grouping testcases by error category, but this is better than before so I'll approve this after a few minor changes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread cpplint.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread CHANGELOG.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

xu xu
fix(junit): narrow count correction
b4371d2
androvonx95
androvonx95 approved these changes Aug 2, 2026
View reviewed changes

@androvonx95 androvonx95 left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Rechecked at b4371d2.

The narrowed change matches the review direction: failures is unique files with findings, changelog wording updated, and num_errors left as the raw error-message count. With only lint findings, tests/failures now match the emitted <testcase> count (e.g. 3 findings in 2 files → failures=2, tests=2, two testcases). Unit test testJUnitXML passes; full suite 206 passed.

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
yangfan-yf-yf
yangfan-yf-yf approved these changes Aug 2, 2026
View reviewed changes

@yangfan-yf-yf yangfan-yf-yf left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Reviewed at b4371d2.

This fixes #431's reported mismatch: lint findings are serialized as one failing testcase per file, and failures plus tests now use that same grouping. The unchanged process-error path is outside #431's lint-finding scope.

Verified locally:

python -m pytest -q --no-cov
231 passed

git diff --check b4371d2^..b4371d2
Passed

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@yangfan-yf-yf yangfan-yf-yf mentioned this pull request Aug 9, 2026
Looking for more maintainers #402
Open
PNHD
PNHD approved these changes Aug 31, 2026
View reviewed changes

@PNHD PNHD left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Reviewed current head b4371d2 against #431.

For the reported lint-finding path, FormatJUnitXML() emits one testcase/failure per affected file, and the unique-filename count makes both failures and tests match that emitted structure. The sample and unit expectation now reflect the same grouping.

This resolves the reported 123-findings / 2-files mismatch. LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
walidbi200
walidbi200 approved these changes Sep 22, 2026
View reviewed changes

@walidbi200 walidbi200 left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Reviewed at b4371d21885b2dc2e4d6e07ca3fbcff8eb718ed6.

I reproduced #431 and verified the grouping behavior independently. Multiple lint findings for the same file are emitted as one failing <testcase>, so counting distinct filenames makes the suite-level failures and tests attributes match the generated testcase structure. The 3-findings/2-files case produces failures="2" tests="2", and the silly JUnit sample correctly reduces the 123 findings across 2 files to 2 failing testcases.

I also checked repeated/non-contiguous findings, mixed error/failure output, and the empty-success case. I found no regression introduced by this change.

Validation:

  • testJUnitXML: passed
  • silly-junit CLI sample: passed
  • full pytest: 231 passed
  • pylint: passed
  • mypy: passed
  • pre-commit: passed
  • git diff --check: passed

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@DanceoftheAurora

DanceoftheAurora commented Nov 9, 2026

Copy link
Copy Markdown

I prepared an optional merge with the current develop: e241f74, on fix/pr457-merge-develop.

Only CHANGELOG.rst needed manual conflict resolution; both entries are retained. The narrowed failure-count correction and its expectations are unchanged, including the existing process-error behavior. Both histories are preserved, so this can be merged into your branch if useful.

Validation on the merged version: 241 tests passed, 96.66% coverage; configured Pylint, Mypy, and applicable pre-commit hooks passed. Prepared with AI assistance.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@aaronliu0130 aaronliu0130 aaronliu0130 requested changes
+4 more reviewers
@PNHD PNHD PNHD approved these changes
@walidbi200 walidbi200 walidbi200 approved these changes
@androvonx95 androvonx95 androvonx95 approved these changes
@yangfan-yf-yf yangfan-yf-yf yangfan-yf-yf approved these changes
Reviewers whose approvals may not affect merge requirements

Requested changes must be addressed to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

JUnit support doesn't count amount of tests correctly

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@neallin917 @DanceoftheAurora @aaronliu0130 @PNHD @walidbi200 @androvonx95 @yangfan-yf-yf
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.