Adopt Shopify's Ruby style guide via rubocop-shopify - #15
Merged
Conversation
Mirrors ast-transform: .rubocop.yml inherits the Shopify config, a lint CI job runs rubocop on Ruby 4.0, and dev style runs it locally. - example_rspock_test.rb is excluded from Lint/Void: bare comparisons and block-name constants ARE the RSpock dialect there. - Development dependencies move from the gemspec to the Gemfile (Gemspec/DevelopmentDependencies). - on_block's half-guarded safe navigation (`children[0]&.children[1]`) becomes an explicit nil check (Lint/SafeNavigationChain). - BlockCapture.capture moves under class << self. - Everything else is autocorrected layout and magic comments. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
3 tasks
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.
Summary
Mirrors ast-transform's setup:
.rubocop.ymlinheritsrubocop-shopify(~> 3.0), alintCI job runs RuboCop on Ruby 4.0, anddev styleruns it locally. 183 offenses fixed;bundle exec rubocopis clean.Judgment calls
Lint/Voidexcluded fortest/example_rspock_test.rb(documented in.rubocop.yml): bare comparisons andGiven/When/Then/Whereconstants are the RSpock dialect — the AST transform rewrites them into assertions, so they are not void.Gemspec/DevelopmentDependencies), as done in ast-transform.Transformation#on_block:node.children[0]&.children[1]only guarded the first call in the chain (Lint/SafeNavigationChain); now an explicit nil check with unchanged semantics.BlockCapture.capturemoves underclass << self(Style/ClassMethodsDefinitions).Layout/LineLengthexempts heredocs (AllowHeredocdefault), and they pin real emitted output.Everything else is autocorrected layout,
frozen_string_literalmagic comments, and hash-syntax modernization.Test plan
dev test: 242 tests, 0 failuresdev style: 59 files inspected, no offensesMade with Cursor
Made with Cursor