Skip to content

fix: update avoid_unnecessary_return_variable#292

Open
solid-illiaaihistov wants to merge 2 commits into
solid-software:analysis_server_migrationfrom
solid-illiaaihistov:fix-236-avoid_unnecessary_return_variable
Open

fix: update avoid_unnecessary_return_variable#292
solid-illiaaihistov wants to merge 2 commits into
solid-software:analysis_server_migrationfrom
solid-illiaaihistov:fix-236-avoid_unnecessary_return_variable

Conversation

@solid-illiaaihistov

Copy link
Copy Markdown
Contributor

Closes #236

@gemini-code-assist gemini-code-assist 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.

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.

@solid-illiaaihistov

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist 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.

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.

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.

1 participant