| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
📝 Walkthrough
WalkthroughThe change updates trailing-semicolon detection for C++20 templated lambdas, including multiline requires clauses. It adds regression tests and records the fix in the changelog. ChangesTemplated Lambda Detection
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CheckTrailingSemicolon
participant MatchLambdaCapture
participant MatchLambdaRequiresClause
CheckTrailingSemicolon->>MatchLambdaCapture: match lambda capture and template boundary
MatchLambdaCapture-->>CheckTrailingSemicolon: return capture match
CheckTrailingSemicolon->>MatchLambdaRequiresClause: inspect multiline requires clause
MatchLambdaRequiresClause-->>CheckTrailingSemicolon: return preceding capture match
Possibly related PRs
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. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
There was a problem hiding this comment.
Duplicate — see my other review on this PR.
Sorry, something went wrong.
There was a problem hiding this comment.
Reviewed at bce7f59 against current develop.
Fixes the #385 case and the harder valid C++20 forms that a same-line ]<...> check misses — multiline template parameter lists, ]<T> with ( on the next line, and trailing requires-clauses. I compiled those with g++ -std=c++20 -pedantic-errors -fsyntax-only and confirmed they stay clean here while ordinary templated/constrained functions and operator[] (including multiline) still warn. Full unit suite: 206 passed.
This conflicts with #458; I’d take this one — it’s the more complete coverage for the same issue.
Sorry, something went wrong.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)cpplint_unittest.py (1)5787-5793: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert the diagnostic for foo.cc.
Line 5792 counts bar_header_error, but this invocation lints test/foo.cc. The assertion passes even if including foo.hpp incorrectly reports that foo.cc omitted its related header.
Proposed fix🤖 Prompt for AI Agents- assert error_collector.Results().count(bar_header_error) == 0 + assert error_collector.Results().count(foo_header_error) == 0Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cpplint_unittest.py` around lines 5787 - 5793, Update the assertion in the multiple-same-basename test to count the diagnostic associated with foo.cc rather than bar_header_error, while preserving the expectation that including foo.hpp produces no related-header error for foo.cc. Use the existing diagnostic symbol or construction for foo.cc from the surrounding test setup.
cpplint_unittest.py (1)🤖 Prompt for all review comments with AI agents3169-3201: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Add coverage for a trailing lambda requires clause.
The new tests only cover a requires clause before the lambda parameter list. C++20 also permits a clause after the parameter list. A matcher regression in that form will pass this suite.
Proposed test+ self.TestMultiLineLint( + "auto identity = []<typename T>(T&& t)\n" + " requires std::integral<T> &&\n" + " std::copyable<T>\n" + "{\n" + " return t;\n" + "};\n", + "", + )Verify this form with the project C++20 compiler.
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cpplint_unittest.py` around lines 3169 - 3201, Add a TestMultiLineLint case alongside the existing generic lambda requires-clause cases covering a trailing requires clause after the lambda parameter list, including a multiline constraint if appropriate. Use valid C++20 syntax and verify the test with the project’s C++20 compiler, expecting no lint errors.
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Outside diff comments: In `@cpplint_unittest.py`: - Around line 5787-5793: Update the assertion in the multiple-same-basename test to count the diagnostic associated with foo.cc rather than bar_header_error, while preserving the expectation that including foo.hpp produces no related-header error for foo.cc. Use the existing diagnostic symbol or construction for foo.cc from the surrounding test setup. --- Nitpick comments: In `@cpplint_unittest.py`: - Around line 3169-3201: Add a TestMultiLineLint case alongside the existing generic lambda requires-clause cases covering a trailing requires clause after the lambda parameter list, including a multiline constraint if appropriate. Use valid C++20 syntax and verify the test with the project’s C++20 compiler, expecting no lint errors.
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6381b6bc-67e3-421c-ac55-69ec440f368d
📥 CommitsReviewing files that changed from the base of the PR and between bce7f59 and fee646d.
📒 Files selected for processing (3)
Sorry, something went wrong.
|
Thanks for the review! I resolved the conflict with current develop in fee646d, preserving both changelog entries. All 231 tests and repository checks pass locally. Could you please take another look when you have time? |
Sorry, something went wrong.
There was a problem hiding this comment.
Rechecked at fee646d. Merge with current develop looks clean — both changelog entries are preserved, and the templated-lambda logic is unchanged from bcf7f59.
Re-ran the earlier cases against this head: #385, multiline template params, ]<T>n(, and requires-clauses stay clean; templated/constrained functions and multiline operator[] still warn. Full suite: 206 passed. Still LGTM.
Sorry, something went wrong.
There was a problem hiding this comment.
Reviewed at fee646d.
The matcher keeps ordinary constrained functions and multiline operator[] declarations in the trailing-semicolon path while recognizing the C++20 templated-lambda forms. I also checked a trailing requires-clause lambda and confirmed it stays clean under the repository's brace-style rule.
Verified locally:
python -m pytest --no-cov -q
231 passed
git diff --check upstream/develop...HEAD
Passed
LGTM.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #385.
The trailing-semicolon check now recognizes C++20 templated lambdas,
including multiline template parameter lists and requires-clauses.
The existing warnings for operator[] and ordinary constrained function
definitions remain unchanged.
Tests:
Summary by CodeRabbit
Bug Fixes
Tests
Documentation