Enable RuboCop Lint/UselessAssignment - #3729
Open
kpumuk wants to merge 1 commit into
Open
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 Lint/UselessAssignment for the Ruby codebase and updates Ruby sources/tests plus the Ruby code generator to avoid assigning values that are never read, while keeping behavior intact.
Changes:
- Enabled
Lint/UselessAssignmentinlib/rb/.rubocop.ymland removed/adjusted unused assignments across Ruby library code, specs, benchmarks, integration tests, and tutorial code. - Updated the Ruby generator to only bind decoded args/results when the generated methods actually consume them (void/no-arg cases avoid unused locals).
- Added/adjusted functional coverage for the Ruby generator and strengthened the Ruby integration string test to exercise both escaped and unicode inputs.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tutorial/rb/RubyClient.rb | Removes an unused assignment in the divide-by-zero tutorial example. |
| test/rb/integration/TestClient.rb | Splits string test inputs and asserts round-trips for both escaped and unicode cases. |
| lib/rb/thrift.gemspec | Removes an unused local variable in gemspec setup. |
| lib/rb/spec/uuid_validation_spec.rb | Avoids unused locals from read_field_begin return values in UUID specs. |
| lib/rb/spec/header_protocol_spec.rb | Avoids unused locals from protocol read APIs in header protocol specs. |
| lib/rb/spec/compact_protocol_spec.rb | Avoids unused locals from read_field_begin in compact protocol spec. |
| lib/rb/lib/thrift/union.rb | Avoids unused field-name locals when reading unions. |
| lib/rb/lib/thrift/struct.rb | Avoids unused field-name locals when reading structs. |
| lib/rb/lib/thrift/server/thread_pool_server.rb | Removes unused rescued exception variable in worker loop. |
| lib/rb/lib/thrift/server/nonblocking_server.rb | Removes unused rescued exception variable in accept loop. |
| lib/rb/lib/thrift/protocol/base_protocol.rb | Avoids unused locals when skipping struct fields. |
| lib/rb/lib/thrift/exceptions.rb | Avoids unused field-name locals when reading application exceptions. |
| lib/rb/benchmark/benchmark.rb | Removes useless accumulator reassignment and an unused local in reporting. |
| lib/rb/.rubocop.yml | Enables Lint/UselessAssignment to enforce unused-assignment cleanup going forward. |
| compiler/cpp/tests/rb/t_rb_generator_functional_tests.cc | Adds functional expectations for void/no-arg Ruby service codegen behavior. |
| compiler/cpp/src/thrift/generate/t_rb_generator.cc | Updates Ruby code generation to avoid unused args/result locals in void/no-arg scenarios. |
💡 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
Lint/UselessAssignmentand remove assignments whose values are never read across the Ruby library, benchmarks, specs, integration client, and tutorial.The Ruby generator now binds decoded service arguments and results only when generated methods consume them. Focused functional coverage verifies zero-argument processor methods and void client receivers. The Ruby cross-test client also exercises its escape/junk string and multilingual string separately, fixing an overwritten test input exposed by the cop.
[skip ci]anywhere in the commit message to free up build resources.