Skip to content

Generate RuboCop-clean Ruby SDK files - #1840

Merged
ChiragAgg5k merged 1 commit into
mainfrom
cursor/ruby-formatter-clean-9f05
Aug 25, 2026
Merged

Generate RuboCop-clean Ruby SDK files#1840
ChiragAgg5k merged 1 commit into
mainfrom
cursor/ruby-formatter-clean-9f05

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Aug 25, 2026

Copy link
Copy Markdown
Member

Summary

  • make Ruby templates emit RuboCop Layout-clean source and packaging files without post-generation formatting
  • ship .rubocop.yml with Layout cops only, 4-space indent matching sdk-for-ruby house style, and a 200-character line limit
  • normalize generated method signatures, hashes, comments, and whitespace directly in Twig
  • enforce check-only RuboCop 1.90.0 validation for the Ruby SDK in CI
before: generate -> run formatter -> commit formatting changes
after:  generate ----------------> formatter-clean SDK

Part of #1813.

Ruby has no inherited/child SDK targets. REST/GraphQL/skills/editor plugins are out of scope.

CI note (web client on d6ea4a9)

Validation job web (client) failed in ~20s on php example.php web client, before any npm step:

Generating SDK: web (platform: client)
Error: Invalid JSON: Syntax error on .../vendor/utopia-php/openapi/src/Parser.php:57

This PR does not change Web templates. The same job on later main (#1842) was green. Cause: getSSLPage() returned non-empty invalid JSON from the live specs fetch (Parser.php:57 json_decode(..., JSON_THROW_ON_ERROR)). Rebased onto main (328cc07fa, #1842) and re-verified locally. No retry/sleep/continue-on-error added.

Greptile review on d6ea4a9 was 5/5 with no line comments.

Test plan

Ruby (#1813):

  • rm -rf examples/ruby && php example.php ruby server — pass (1/1 after rebase)
  • (cd examples/ruby && rubocop) — 405 files inspected, no offenses (1/1)
  • rm -rf examples/ruby && php example.php ruby client && (cd examples/ruby && rubocop) — 120 files, no offenses (1/1, pre-rebase)
  • composer lint-twig — 0 errors
  • vendor/bin/phpcs src/SDK/Language/Ruby.php — pass

Web (the red CI job, after rebase):

  • Fetch open-api3-1.9.x-client.json and json_decode — valid JSON (1/1)
  • rm -rf examples/web && php example.php web client — pass (1/1)
  • (cd examples/web && npm ci && npm audit && npm run format:check && npm run lint && npm run analyse && npm run build) — pass (1/1)

Console generation (php example.php ruby console) still hits a pre-existing Lint/Syntax failure in console_variables.rb: several _APP_* schema names collapse to the same snake_case keyword. That collision exists on main and is not introduced here.

Open in Web Open in Cursor 

@ChiragAgg5k
ChiragAgg5k marked this pull request as ready for review August 25, 2026 04:04
@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR updates Ruby SDK templates to emit RuboCop Layout-clean code directly and adds generated RuboCop configuration plus CI validation.

  • Adds a Ruby-specific rtrimLines Twig filter and emits .rubocop.yml with generated SDKs.
  • Reformats generated Ruby package, client, model, service, and support templates.
  • Adds pinned RuboCop validation to the Ruby generation workflow.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/SDK/Language/Ruby.php Adds the generated RuboCop configuration to the Ruby file plan and registers a line-trimming template filter.
templates/ruby/lib/container/services/service.rb.twig Reworks generated documentation and method signatures into RuboCop-compliant multiline output while preserving parameter and multipart branches.
templates/ruby/lib/container/models/model.rb.twig Normalizes model formatting, optional-default emission, commas, and enum validator generation without an established blocking failure.
templates/ruby/base/params.twig Emits explicit empty request and header hashes and formats populated hashes consistently.
templates/ruby/lib/container/client.rb.twig Applies layout-oriented formatting to client initialization, upload progress callbacks, payload handling, and encoders.
templates/ruby/.rubocop.yml Defines Layout-only RuboCop checks targeting Ruby 2.7 with four-space indentation and a 200-character line limit.
.github/workflows/validation.yml Pins RuboCop 1.90.0 and validates that generated Ruby SDKs include and pass their RuboCop configuration.

Reviews (2): Last reviewed commit: "feat: generate RuboCop-clean Ruby SDK fi..." | Re-trigger Greptile

Emit Layout-clean Ruby from Twig templates so a fresh generation already
matches RuboCop 1.90.0 (4-space indent, Layout cops only). Ship .rubocop.yml
with the SDK and fail CI on formatter regressions.

Co-authored-by: Chirag Aggarwal <chiragaggarwal5k@gmail.com>
@cursor
cursor Bot force-pushed the cursor/ruby-formatter-clean-9f05 branch from d6ea4a9 to aaaae29 Compare August 25, 2026 05:41
@ChiragAgg5k
ChiragAgg5k merged commit 0c1db97 into main Aug 25, 2026
59 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the cursor/ruby-formatter-clean-9f05 branch August 25, 2026 05:52
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.

2 participants