Enable RuboCop Style/RedundantReturn - #3728
Merged
Merged
Conversation
Client: rb Co-Authored-By: OpenAI Codex (GPT-5.6) <codex@openai.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Enables RuboCop Style/RedundantReturn for the Ruby codebase and updates Ruby sources plus the Ruby code generator output to avoid explicit return where Ruby already returns the final expression, while keeping generated client/process control flow and return values consistent.
Changes:
- Enable
Style/RedundantReturninlib/rb/.rubocop.yml. - Remove redundant trailing
returnstatements across Ruby tutorial/test/runtime code where the final expression is sufficient. - Update the Ruby generator to emit
recv_*calls as final expressions and adjust generated void/oneway terminalreturnsites tonil, with a functional test asserting the generated non-void client method shape.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tutorial/rb/RubyServer.rb | Removes redundant returns in tutorial handler methods. |
| test/rb/integration/TestServer.rb | Removes redundant returns in Ruby integration test handler methods. |
| lib/rb/lib/thrift/transport/memory_buffer_transport.rb | Removes redundant return true in open?. |
| lib/rb/lib/thrift/transport/framed_transport.rb | Removes redundant returns in read_byte and factory get_transport. |
| lib/rb/lib/thrift/transport/buffered_transport.rb | Removes redundant returns in open?, read_byte, and factory get_transport. |
| lib/rb/lib/thrift/transport/base_transport.rb | Removes redundant return in read_byte and factory get_transport. |
| lib/rb/lib/thrift/protocol/json_protocol.rb | Removes redundant trailing returns (and case-branch returns) where the expression value suffices. |
| lib/rb/lib/thrift/protocol/binary_protocol.rb | Removes redundant return in protocol factory get_protocol. |
| lib/rb/.rubocop.yml | Enables Style/RedundantReturn. |
| compiler/cpp/tests/rb/t_rb_generator_functional_tests.cc | Adds an assertion for generated non-void client method shape (send_* followed by recv_* as final expression). |
| compiler/cpp/src/thrift/generate/t_rb_generator.cc | Updates Ruby generator output to avoid redundant returns and emit nil for terminal void/oneway paths. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enable
Style/RedundantReturnand remove explicitreturnkeywords where Ruby already returns the final expression.The Ruby generator now emits service client receive calls as final expressions. Generated void and oneway paths that previously used a bare early
returnemitnilinstead, preserving their control flow and return value while keeping generated code compliant with the cop. Functional coverage verifies the generated non-void client method shape.This follows the merged
Style/RedundantBeginPR #3727; its diff contains only theRedundantReturnlayer.[skip ci]anywhere in the commit message to free up build resources.