Repository navigation
fix: handle lambdas in control conditions - #446
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
ChangesLambda-aware control brace detection
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
lovewave02
left a comment
There was a problem hiding this comment.
I reviewed this against the current develop branch and the examples in #410. The merge simulation is clean; the full suite passes with 226 tests, and pylint, mypy, and the changed-file pre-commit hooks pass. I also checked lambda conditions across if, while, for, and switch, and inline control bodies are still flagged. This looks ready to merge.
|
@aaronliu0130 Your review, please. |
|
Checked out this branch and verified against the #410 examples plus while/for lambda conditions. False positives are gone, and inline control bodies (if / switch) are still flagged. Full idea looks sound with CloseExpression. LGTM. |
| self.TestLint( | ||
| "if (condition) { return true; }", | ||
| "Controlled statements inside brackets of if clause should be on a separate line" | ||
| " [whitespace/newline] [5]", | ||
| ) |
There was a problem hiding this comment.
This duplicates the existing tests of this pattern, but it's not big enough of a deal that I would revert it. Just be more careful next time :)
Fixes #410.
The control-body check now uses CloseExpression to find the closing parenthesis of a control condition.
This prevents lambda bodies inside conditions from being mistaken for inline control bodies.
Checks: pytest with 226 passing tests, Pylint, and Mypy.
Summary by CodeRabbit
Bug Fixes
Tests
Documentation