Skip to content

test: preview the redesigned cpp-linter v2 comment, review and annotations - #82

Closed
shenxianpeng wants to merge 5 commits into
masterfrom
claude/project-thread-plvb9l
Closed

shenxianpeng wants to merge 5 commits into
masterfrom
claude/project-thread-plvb9l

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Requested by Xianpeng · project thread

Temporary PR, not for merging. It runs cpp-linter v2 built from the claude/project-thread-plvb9l branch of cpp-linter-rs on the same demo code as the current README screenshots, so the redesigned thread comment, PR review and annotations can be captured for the cpp-linter-rs PR. Close it (and delete the branch) after the screenshots are taken.

github-actions[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

⚠ cpp-linter found 3 issues in 1 file

Tool Result
⚠ clang-format 21.1.8 1 file needs formatting
⚠ clang-tidy 21.1.8 2 warnings, 1 fixable
clang-tidy: 2 warnings, 1 fixable

src/demo.cpp

Line Finding
12 implicit conversion 'const char *' -> 'bool' (fixable)
readability-implicit-bool-conversion
23 42 is a magic number; consider replacing it with a named constant
readability-magic-numbers
clang-format: 1 file
  • src/demo.cpp, line 12
How to fix

From the repository root, format the listed lines with clang-format 21:

clang-format -i --style=file --lines=12:12 src/demo.cpp

Or apply every fix at once: this step's fix-patch-path output is a patch for git apply.

Or give this to your coding agent:

Fix these clang-tidy findings:
- src/demo.cpp:12:13: warning: implicit conversion 'const char *' -> 'bool' [readability-implicit-bool-conversion]
- src/demo.cpp:23:34: warning: 42 is a magic number; consider replacing it with a named constant [readability-magic-numbers]

Powered by cpp-linter | Feedback

@github-actions
github-actions Bot dismissed their stale review November 19, 2026 22:55

outdated review

github-actions[bot]

This comment was marked as outdated.

@github-actions
github-actions Bot dismissed their stale review November 19, 2026 23:03

outdated review

github-actions[bot]

This comment was marked as outdated.

@github-actions
github-actions Bot dismissed their stale review November 19, 2026 23:10

outdated review

github-actions[bot]

This comment was marked as outdated.

github-actions[bot]

This comment was marked as outdated.

@github-actions
github-actions Bot dismissed their stale review November 20, 2026 07:14

outdated review

github-actions[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Member Author

A · Current (solid circles)

x cpp-linter found 3 issues in 1 file

Check Result
x clang-format 21.1.8 1 file needs formatting
x clang-tidy 21.1.8 no findings

x Warning · readability-magic-numbers

B · Emoji

🟡 cpp-linter found 3 issues in 1 file

Check Result
🟡 clang-format 21.1.8 1 file needs formatting
🟢 clang-tidy 21.1.8 no findings

🟡 Warning · readability-magic-numbers

C · Proposal (brand ring tile + line glyphs)

x cpp-linter found 3 issues in 1 file

Check Result
x clang-format 21.1.8 1 file needs formatting
x clang-tidy 21.1.8 no findings

x Warning · readability-magic-numbers

C · all three states

x cpp-linter passed

x cpp-linter found 3 issues in 1 file

x cpp-linter found 1 error in 1 file

x passed   x warning   x error


Generated by Claude Code

Copy link
Copy Markdown
Member Author

D · Brand mark in the heading, emoji elsewhere

! cpp-linter found 3 issues in 1 file

Check Result
⚠️ clang-format 21.1.8 1 file needs formatting
✅ clang-tidy 21.1.8 no findings

⚠️ Warning · readability-magic-numbers

✔ cpp-linter passed

✖ cpp-linter found 1 error in 1 file

Check Result
✅ clang-format 21.1.8 all files formatted
❌ clang-tidy 21.1.8 1 error

❌ Error · bugprone-use-after-move

E · Emoji only

⚠️ cpp-linter found 3 issues in 1 file

Check Result
⚠️ clang-format 21.1.8 1 file needs formatting
✅ clang-tidy 21.1.8 no findings

Generated by Claude Code

Copy link
Copy Markdown
Member Author

R1 · 20px glyphs

! cpp-linter found 3 issues in 1 file

Check Result
! clang-format 21.1.8 1 file needs formatting
✔ clang-tidy 21.1.8 no findings
✖ clang-tidy 21.1.8 1 error

! Warning: readability-magic-numbers

R2 · 20px color chips

! cpp-linter found 3 issues in 1 file

Check Result
! clang-format 21.1.8 1 file needs formatting
✔ clang-tidy 21.1.8 no findings
✖ clang-tidy 21.1.8 1 error

! Warning: readability-magic-numbers

R3 · 20px brand tiles

! cpp-linter found 3 issues in 1 file

Check Result
! clang-format 21.1.8 1 file needs formatting
✔ clang-tidy 21.1.8 no findings
✖ clang-tidy 21.1.8 1 error

! Warning: readability-magic-numbers


Generated by Claude Code

Copy link
Copy Markdown
Member Author

R2b · color chips inside the Check column

! cpp-linter found 3 issues in 1 file

Check Result
! clang-format 21.1.8 1 file needs formatting
✔ clang-tidy 21.1.8 no findings
✖ clang-tidy 21.1.8 1 error

R3b · brand tiles inside the Check column

Check Result
! clang-format 21.1.8 1 file needs formatting
✔ clang-tidy 21.1.8 no findings
✖ clang-tidy 21.1.8 1 error

Generated by Claude Code

@2bndy5

2bndy5 commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

The yellow circle I drew was inspired by teacher markings on a graded paper. So, the opening of the circle is not always at a fixed angle. If you make the circle opening around the top of the exclamation point, then that might vibe better.

shenxianpeng commented Nov 20, 2026 •

Copy link
Copy Markdown
Member Author

1. Thread comment (and step summary)

! cpp-linter found 3 issues in 1 file

Check Result
! clang-format 21.1.8 1 file needs formatting
! clang-tidy 21.1.8 2 warnings, 1 fixable
clang-tidy: 2 warnings, 1 fixable

src/demo.cpp

Line Finding
12 implicit conversion 'const char *' -> 'bool' (fixable)
readability-implicit-bool-conversion
23 42 is a magic number; consider replacing it with a named constant
readability-magic-numbers
clang-format: 1 file
  • src/demo.cpp, line 12
How to fix

Formatting. Run this in the repository root with clang-format 21. It formats only the lines listed above.

clang-format -i --style=file --lines=12:12 src/demo.cpp

All fixes as one patch. The fix-patch-path output of this step names a patch file with every fix from clang-format and clang-tidy. Apply it with git apply.

With an AI coding agent. Paste this prompt:

Fix these clang-tidy findings:
- src/demo.cpp:12:13: warning: implicit conversion 'const char *' -> 'bool' [readability-implicit-bool-conversion]
- src/demo.cpp:23:34: warning: 42 is a magic number; consider replacing it with a named constant [readability-magic-numbers]

✨ Powered by cpp-linter | 💬 Feedback

2. When everything passes

✔ cpp-linter passed

clang-format 21.1.8, clang-tidy 21.1.8, 4 files checked

✨ Powered by cpp-linter | 💬 Feedback

3. When there is an error

✖ cpp-linter found 1 error in 1 file

Check Result
✔ clang-format 21.1.8 all files formatted
✖ clang-tidy 21.1.8 1 error

4. PR review summary

! cpp-linter review

2 comments for clang-format 21.1.8 and clang-tidy 21.1.8

✨ Powered by cpp-linter | 💬 Feedback

5. Inline review comment

! Warning: readability-implicit-bool-conversion

implicit conversion 'const char *' -> 'bool'

    return name != nullptr;

shenxianpeng commented Nov 20, 2026 •

Copy link
Copy Markdown
Member Author

1. Thread comment (and step summary)

! cpp-linter found 3 issues in 1 file

Check Result
! clang-format 21.1.8 1 file needs formatting
! clang-tidy 21.1.8 2 warnings, 1 fixable
clang-tidy: 2 warnings, 1 fixable

src/demo.cpp

Line Finding
12 implicit conversion 'const char *' -> 'bool' (fixable)
readability-implicit-bool-conversion
23 42 is a magic number; consider replacing it with a named constant
readability-magic-numbers
clang-format: 1 file
  • src/demo.cpp, line 12
How to fix

Format the listed lines with clang-format 21:

clang-format -i --style=file --lines=12:12 src/demo.cpp

Or apply every fix at once: this step's fix-patch-path output is a patch for git apply.

Or give this to your coding agent:

Fix these clang-tidy findings:
- src/demo.cpp:12:13: warning: implicit conversion 'const char *' -> 'bool' [readability-implicit-bool-conversion]
- src/demo.cpp:23:34: warning: 42 is a magic number; consider replacing it with a named constant [readability-magic-numbers]

Powered by cpp-linter | Feedback

2. When everything passes

✔ cpp-linter passed

clang-format 21.1.8, clang-tidy 21.1.8, 4 files checked

Powered by cpp-linter | Feedback

3. When there is an error

✖ cpp-linter found 1 error in 1 file

Check Result
✔ clang-format 21.1.8 all files formatted
✖ clang-tidy 21.1.8 1 error

Powered by cpp-linter | Feedback

4. PR review summary

! cpp-linter review

2 comments for clang-format 21.1.8 and clang-tidy 21.1.8

Powered by cpp-linter | Feedback

5. Inline review comment

! Warning: readability-implicit-bool-conversion

implicit conversion 'const char *' -> 'bool'

    return name != nullptr;

Generated by Claude Code

@github-actions
github-actions Bot dismissed their stale review November 20, 2026 23:42

outdated review

@github-actions github-actions Bot 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.

⚠ cpp-linter review

2 comments (clang-format 21.1.8, clang-tidy 21.1.8)

Powered by cpp-linter | Feedback

Comment thread src/demo.cpp
namespace {
bool hasName(const char* name)
{
return name;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠ Warning: readability-implicit-bool-conversion

implicit conversion 'const char *' -> 'bool'

Suggested change
return name;
return name != nullptr;

Comment thread src/demo.cpp
printf("Hello world!\n");

return 0;
return hasName("demo") ? 0 : 42;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠ Warning: readability-magic-numbers

42 is a magic number; consider replacing it with a named constant

shenxianpeng added a commit to cpp-linter/cpp-linter-rs that referenced this pull request Nov 21, 2026
Everything cpp-linter posts on a pull request is seen by the author's
reviewers too, so it should read at a glance: the result first, then the
findings, then how to fix them. This redesigns the thread comment (and
step summary, which shares its renderer), the PR review, and the file
annotations for v2.

The screenshots below are the same demo code before and after, captured
from a real run in cpp-linter/test-cpp-linter-action#82.

## Before and after

| | Before | After |
|:--|:--|:--|
| Thread comment | <img
src="https://raw.githubusercontent.com/cpp-linter/cpp-linter-rs/1e8bd37/docs/docs/images/thread-comment-light.png"
width="400"> | <img
src="https://raw.githubusercontent.com/cpp-linter/cpp-linter-rs/731a3b3/docs/docs/images/thread-comment-light.png"
width="400"> |
| PR review | <img
src="https://raw.githubusercontent.com/cpp-linter/cpp-linter-rs/1e8bd37/docs/docs/images/pr-review-light.png"
width="400"> | <img
src="https://raw.githubusercontent.com/cpp-linter/cpp-linter-rs/731a3b3/docs/docs/images/pr-review-light.png"
width="400"> |
| Annotations in the diff | <img
src="https://raw.githubusercontent.com/cpp-linter/cpp-linter-rs/1e8bd37/docs/docs/images/annotations-diff-light.png"
width="400"> | <img
src="https://raw.githubusercontent.com/cpp-linter/cpp-linter-rs/a000db3/docs/docs/images/annotations-diff-light.png"
width="400"> |
| Annotations in the run | <img
src="https://raw.githubusercontent.com/cpp-linter/cpp-linter-rs/1e8bd37/docs/docs/images/annotations-summary-light.png"
width="400"> | <img
src="https://raw.githubusercontent.com/cpp-linter/cpp-linter-rs/a000db3/docs/docs/images/annotations-summary-light.png"
width="400"> |

Dark mode versions are in `docs/docs/images/*-dark.png`.

## What changed

**Status marks**
- The marks are drawn from the logo: "passed" is the logo itself, and
"warned" and "failed" keep its ring with a brush `!` or a red X that
breaks out of the ring's gap where the logo's check does. Headings use
the ringed mark at 24px; table rows and inline review comments use the
glyph alone at 20px. Each `<img>` has the glyph as `alt` text.
- They are served from the org site under a short path
(`https://cpp-linter.github.io/m/`,
cpp-linter/cpp-linter.github.io#105), so a mark tag is about 85 bytes.
`make_marks.py` in `branding/status/brush/` of cpp-linter/.github
rebuilds them from the logo.

**Thread comment and step summary**
- The heading states the result: `cpp-linter found 3 issues in 1 file`,
or `cpp-linter passed` with one line of versions and the number of files
checked.
- A Tool / Result table gives one row per tool, with the row's mark
inside the Tool cell (GitHub mobile shrinks a separate narrow mark
column). Then the clang-tidy findings as a table per file (line,
message, check link, "(fixable)"), then the files clang-format would
change, with their lines.
- A folded "How to fix" section gives the ways to fix in three short
lines: the exact `clang-format -i` command (scoped with `--lines` when
only changed lines are checked, so it never reformats untouched code),
the `fix-patch-path` output when this run wrote a patch, and a prompt to
give to a coding agent.
- When the comment would pass GitHub's size limit, it says how many
findings were left out instead of cutting text. Room for "How to fix" is
kept first, and the AI prompt lists 50 findings at most.
- File names and commands are relative to the repository root, also when
`--repo-root` is a subdirectory, so the commands work where the comment
says to run them.

**PR review**
- The heading mark is amber for warnings and red when a changed line has
an error or clang-format failed, like the thread comment. An error that
has nothing to post (no fix for that file) also keeps the review from
approving.
- The summary is one line: `2 comments (clang-format 21.1.8, clang-tidy
21.1.8)`, plus a sentence only when some findings fall outside the diff
or were already posted.
- Each inline comment starts with the mark, the severity and the linked
check name, then the message and the suggestion. The `path:line` header
and the copied code snippet are gone, since GitHub already shows both
right above the comment.

**Annotations**
- Titles are the check name (or `clang-format`), without repeating the
file and line.
- The clang-format annotation points at the first changed line instead
of line 0, says which lines differ, names the style (`the style in
.clang-format` instead of `Custom`), and gives the command to fix it.
- The Code Quality report uses the same style wording.

**Wording**
- No emoji and no `·` or `•` separators: the tables do the separating,
and the text uses commas and colons. The footer is `Powered by
cpp-linter | Feedback`.
- Counts agree with their nouns (`1 file`, `2 warnings`), and text from
clang is escaped so `*`, `|` or `<T>` can't break the Markdown.

## Notes for reviewers
- The step summary and `--summary-output-file` are written after the
patch and before the review is posted, so a failed review still leaves
the summary.
- Inline review comment bodies changed, so the first run after upgrading
will post new review comments instead of reusing the old ones.
- The step summary screenshots in the README were not reshot: GitHub
only shows step summaries to signed-in users. It renders the same
Markdown as the thread comment above.
- `main` (with the footer trim from #594) is merged into this branch.
The footer also drops its `---` rule: GitHub draws it with wide margins,
which left a large gap above the one grey "Powered by" line.

## Testing
- `cargo test --all-features` (lib, `comments` and `reviews` integration
tests) and `cargo clippy --all-features --all-targets` pass. A few lib
tests that set environment variables can fail when the whole lib suite
runs in one process; they pass on their own and fail the same way on
`main` (CI runs each test in its own process).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

## Summary

* **New Features**
* Review comments now include status indicators, concise summaries,
linked diagnostics, and relevant fix guidance.
* clang-format findings describe the configured style and identify
affected lines; clang-tidy findings include severity and diagnostic
details.
* Formatting commands can target changed lines, and long reports
indicate when findings are omitted.
  * Reviews can include generated patches when available.

* **Bug Fixes**
* Review summaries better distinguish errors, warnings, findings outside
the diff, and clean results.
* clang-tidy errors on changed lines are reported as failures, even when
no patched file is available.
  * Fix notices use clearer singular and plural wording.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

2 participants