fix: update avoid_unnecessary_return_variable#292
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the AvoidUnnecessaryReturnVariableVisitor to handle parenthesized return expressions and correctly resolve the enclosing block function body. It also refactors the visitor to check for the variable declaration earlier, allowing safe access to its initializer. Additionally, new test cases are added to cover nested blocks and parenthesized returns. The review feedback suggests simplifying the retrieval of the enclosing block by using optional chaining on thisOrAncestorOfType<BlockFunctionBody>() to make the code more concise.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request improves the avoid_unnecessary_return_variable lint rule. It updates the visitor to correctly handle parenthesized return expressions and properly resolve the enclosing block function body by using thisOrAncestorOfType<BlockFunctionBody>(). It also refactors the declaration null-checking logic and adds corresponding unit tests to cover nested blocks and parenthesized return statements. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Closes #236