Skip to content

feat: add GitHub Actions output format - #468

Open
PNHD wants to merge 1 commit into
cpplint:developfrom
PNHD:fix/419-github-output-format
Open

PNHD wants to merge 1 commit into
cpplint:developfrom
PNHD:fix/419-github-output-format

Conversation

@PNHD

@PNHD PNHD commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #419.

Summary

  • add --output=github support for GitHub Actions annotations
  • emit cpplint findings as ::warning workflow commands
  • include file, line, and cpplint title metadata
  • escape GitHub Actions command data and properties correctly
  • treat GitHub output as machine-readable output on stdout
  • document the new output format in the CLI help and changelog
  • add CLI regression coverage and unit tests for command escaping

Testing

  • pytest --no-cov cpplint_clitest.py -k github_output
  • pytest --no-cov cpplint_unittest.py -k github_command_escaping
  • full test suite: 233 passed
  • total coverage: 96.48%
  • repository pre-commit checks: passed

Summary by CodeRabbit

  • New Features

    • Added a --output=github format that emits GitHub Actions warning annotations.
    • Included file, line, title, and lint category details in generated annotations.
    • Updated command-line help and output format validation to support the new option.
  • Documentation

    • Added the GitHub output format to the unreleased changelog.
  • Tests

    • Added coverage for GitHub annotation formatting and special-character escaping.

@coderabbitai

coderabbitai Bot commented Aug 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: defaults

Review profile: CHILL

Plan: Team

Run ID: 7f6f074a-446d-4957-99d0-71eb8011f2f4

📥 Commits

Reviewing files that changed from the base of the PR and between e5bf542 and 307051b.

📒 Files selected for processing (1)
  • cpplint_unittest.py

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

cpplint adds --output=github. The format emits escaped GitHub Actions warning annotations with file, line, title, and lint message data. CLI validation, help text, changelog content, integration tests, and escaping unit tests are updated.

Changes

GitHub Actions output

Layer / File(s) Summary
Register the github output format
cpplint.py
CLI usage, help text, validation, machine-output handling, and output-format documentation include github.
Format and escape warning annotations
cpplint.py
New escaping helpers encode GitHub command data and properties. Error() emits ::warning annotations with file, line, title, and message values.
Validate the output format
cpplint_clitest.py, cpplint_unittest.py, CHANGELOG.rst
Tests verify annotation output and escaping behavior. The changelog records the new format.

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

Merge Risk: ⚪ Minimal · up to 30705

This adds GitHub Actions warning annotations for cpplint findings, with escaped metadata and messages. The command format, CLI behavior, and escaping are covered by tests, so the change is ready to merge.

Suggested reviewers: aaronliu0130

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Error
  participant stdout
  CLI->>Error: report lint error with github output
  Error->>Error: escape command properties and data
  Error->>stdout: write ::warning annotation
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. 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 and concisely describes the primary change: adding a GitHub Actions output format.
Linked Issues check ✅ Passed The changes implement issue #419 by adding the --output=github formatter, emitting GitHub Actions warning annotations, escaping command data and properties, and adding tests and documentation.
Out of Scope Changes check ✅ Passed The changelog, CLI help updates, escaping helpers, formatter registration, and regression tests directly support the GitHub output objective. No unrelated code changes are identified.
  • Fix all pre-merge checks with AI
✨ 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.

@PNHD
PNHD force-pushed the fix/419-github-output-format branch from e5bf542 to 307051b Compare September 7, 2026 00:43

@walidbi200 walidbi200 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed current head 307051b.

The GitHub Actions annotation format and escaping look correct. Command data escapes %, CR, and LF, while properties additionally escape : and ,. Adding github to the machine-output formats also keeps informational output out of the annotation stream.

Verified locally:

  • targeted GitHub-output tests pass
  • full suite: 233 passed, 96.48% coverage
  • pylint passes

I also checked unusual filename/property characters and the linenum <= 0 path; I didn't find a blocking issue.

LGTM.

@cclauss
cclauss self-requested a review September 13, 2026 19:40

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a github output format

3 participants