Skip block comment containing a comma between call arguments#21
Conversation
|
Warning Review limit reached
More reviews will be available in 50 minutes and 23 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe forward scan in JavaExpressionBuilder.buildCallExpression that extends an argument's end to the next argument now detects and skips both line (//) and block (/* */) comments using tokensIn, advancing the scan index past entire comment tokens so commas inside comments are ignored when locating the real separating comma. Three new JUnit tests assert canonical formatting is preserved for inline block, Javadoc, and line comments that contain commas between wrapped arguments. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Pull request overview
This PR addresses a Java formatter/scanner edge case where the argument-separator comma scan can be thrown off by commas that appear inside comments between call arguments.
Changes:
- Added a regression test covering an inline block comment containing a comma between invocation arguments.
- Updated
JavaExpressionBuilderto skip over block comments when scanning for the comma that separates adjacent arguments.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
airstyle-core/src/test/java/io/airlift/airstyle/TestCommentPreservationFormatting.java |
Adds a regression test for inline block comments containing commas between arguments. |
airstyle-core/src/main/java/io/airlift/airstyle/engine/java/JavaExpressionBuilder.java |
Adjusts the comma-detection scan between arguments to ignore commas inside block comments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The scanner explicitly looks for commas, but gets confused when the comma is not part of Java syntax - or, in other words, is in a comment.
615786f to
7e8cf21
Compare
The scanner explicitly looks for commas, but gets confused when the comma is not part of Java syntax - or, in other words, is in a comment.