Enforce Ruby whitespace layout rules - #3719
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
This PR tightens and enforces Ruby layout/whitespace rules via RuboCop across the Ruby library, specs, tests, and tutorials, and updates the Ruby code generator so regenerated code consistently follows the same layout (preventing new lint offenses).
Changes:
- Enable additional RuboCop
Layout/*cops inlib/rb/.rubocop.ymland autocorrect existing Ruby sources to comply. - Adjust the Ruby generator (
t_rb_generator) to avoid introducing extra empty lines in generated structs/unions/services (including empty services). - Extend Ruby generator functional tests to assert the new generated formatting for services, structs, unions, and multiline literals/metadata.
Reviewed changes
Copilot reviewed 22 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tutorial/rb/RubyServer.rb | Removes trailing whitespace-only blank lines to satisfy layout rules. |
| tutorial/rb/RubyClient.rb | Removes a whitespace-only blank line before rescue to satisfy layout rules. |
| test/rb/integration/TestServer.rb | Removes a whitespace-only blank line at class boundary. |
| test/rb/integration/TestClient.rb | Removes a whitespace-only blank line before closing end. |
| test/rb/generation/test_struct.rb | Removes whitespace-only blank lines inside the test class. |
| test/rb/generation/test_recursive.rb | Removes an extra blank line at the start of a test body. |
| test/rb/generation/test_enum.rb | Adds an empty line after include to match enforced layout rules. |
| lib/rb/spec/union_spec.rb | Adjusts brace spacing in expect { ... } to match enforced RuboCop layout. |
| lib/rb/spec/base_transport_spec.rb | Adjusts brace spacing in expect { ... } occurrences. |
| lib/rb/lib/thrift/transport/server_socket.rb | Removes trailing whitespace-only blank line at class end. |
| lib/rb/lib/thrift/transport/io_stream_transport.rb | Adds an empty line before to_s to satisfy empty-line placement rules. |
| lib/rb/lib/thrift/transport/http_client_transport.rb | Normalizes empty lines around one-line defs (open?, read, write) and class body. |
| lib/rb/lib/thrift/struct_union.rb | Removes trailing whitespace-only blank line at module/class end. |
| lib/rb/lib/thrift/server/thin_http_server.rb | Removes an extra blank line after class declaration. |
| lib/rb/lib/thrift/protocol/protocol_decorator.rb | Removes an extra blank line after module declaration. |
| lib/rb/lib/thrift/protocol/multiplexed_protocol.rb | Removes an extra blank line after class declaration. |
| lib/rb/lib/thrift/protocol/json_protocol.rb | Removes extra blank lines inside nested class definitions. |
| lib/rb/lib/thrift/protocol/compact_protocol.rb | Removes an extra blank line after class declaration. |
| lib/rb/lib/thrift/protocol/base_protocol.rb | Removes extra blank lines after class declarations. |
| lib/rb/lib/thrift/multiplexed_processor.rb | Removes an extra blank line after nested class declaration. |
| lib/rb/lib/thrift/exceptions.rb | Removes extra blank lines in exception definitions. |
| lib/rb/ext/extconf.rb | Normalizes block brace spacing (`File.open(...) { |
| lib/rb/.rubocop.yml | Enables additional RuboCop Layout/* cops (empty-line placement, alignment, and block-brace spacing). |
| compiler/cpp/tests/rb/t_rb_generator_functional_tests.cc | Updates/extends functional tests to assert generator output formatting for services, structs, unions, and multiline layouts. |
| compiler/cpp/src/thrift/generate/t_rb_generator.cc | Updates the Ruby generator to emit consistent empty-line layout and avoid blank lines before end for empty/last definitions. |
💡 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.
This enables RuboCop checks for empty-line placement, rescue and ensure alignment, and spacing before block braces across the Ruby library, tests, and tutorials. Existing sources are autocorrected to match the rules.
The Ruby generator now emits the same empty-line layout for structs, unions, and service classes, including classes without fields or methods, so regenerating code does not reintroduce offenses. Functional generator coverage records the expected output shape.
[skip ci]anywhere in the commit message to free up build resources.