Skip to content

Conversation

@tnir
Copy link
Contributor

@tnir tnir commented Oct 22, 2025

Why

In a newly-created rails app codebase, developers would get RuboCop offenses as follow:

$ rails new xyz && cd xyz
$ bundle add cypress-on-rails
$ bundle exec rails g cypress_on_rails:install
$ bundle exec rubocop
Inspecting 31 files
................C..............

Offenses:

config/initializers/cypress_on_rails.rb:18:1: C: [Correctable] Layout/TrailingWhitespace: Trailing whitespace detected.
config/initializers/cypress_on_rails.rb:21:70: C: [Correctable] Layout/TrailingWhitespace: Trailing whitespace detected.
    # c.server_port = 3001         # or use ENV['CYPRESS_RAILS_PORT']  
                                                                     ^^
config/initializers/cypress_on_rails.rb:23:1: C: [Correctable] Layout/TrailingWhitespace: Trailing whitespace detected.

31 files inspected, 3 offenses detected, 3 offenses autocorrectable
takuya.noguchi@t cog % bundle exec rubocop e2e/e2e_helper.rb
Inspecting 1 file
.

1 file inspected, no offenses detected

While no warnings in spec/e2e/e2e_helper.rb.erb with the rubocop-rails-omakase, the default RuboCop configuration as of 2025, we should pay attention to spec/e2e/e2e_helper.rb.erb (Layout/*Indentation cops at least) as well.

$ bundle exec rubocop e2e/e2e_helper.rb
Inspecting 1 file
C

Offenses:

e2e/e2e_helper.rb:1:1: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
# This is loaded once before the first command is executed
^
e2e/e2e_helper.rb:32:5: C: [Correctable] Layout/FirstArgumentIndentation: Indent the first argument one step more than the start of the previous line.
    always_reload: false, ...
    ^^^^^^^^^^^^^^^^^^^^^
e2e/e2e_helper.rb:38:1: C: [Correctable] Layout/ClosingParenthesisIndentation: Indent ) to column 2 (not 0)
)
^

1 file inspected, 3 offenses detected, 3 offenses autocorrectable

You would say Style/FrozenStringLiteralComment can be ignored.

Changes

  • Removes extra spaces from the generator template files to remove them from the generated files.

Summary by CodeRabbit

  • Style
    • Updated code formatting and indentation in configuration and test helper templates for improved consistency and readability.

@coderabbitai
Copy link

coderabbitai bot commented Oct 22, 2025

Walkthrough

Two template files received whitespace and indentation adjustments. The cypress_on_rails.rb.erb initializer file gained blank lines around logger and configuration sections. The e2e_helper.rb.erb file had its SmartFactoryWrapper configuration indentation normalized from four to two spaces. No behavioral changes.

Changes

Cohort / File(s) Summary
Template Formatting
lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb, lib/generators/cypress_on_rails/templates/spec/e2e/e2e_helper.rb.erb
Whitespace and indentation normalization: blank lines added around configuration sections; SmartFactoryWrapper configuration indentation adjusted to two spaces.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Poem

🐰 Two templates gleam with spacing so neat,
Indents aligned to a rhythm complete!
No logic bent, just whitespace refined—
A rabbit's delight: consistency defined! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "style: remove extra spaces from the generated files" accurately describes the primary changes in this PR, which consist of whitespace and indentation adjustments in generator template files. The title uses the conventional commit prefix "style:" appropriately for formatting-related changes and is specific enough to convey the purpose without being vague. Both file modifications target spacing issues—one adjusts blank line placement and the other corrects indentation from four spaces to two spaces—which directly aligns with the stated objective to resolve RuboCop trailing whitespace and indentation offenses in generated files.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1a7dd6 and 8b7cd0d.

📒 Files selected for processing (2)
  • lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb (1 hunks)
  • lib/generators/cypress_on_rails/templates/spec/e2e/e2e_helper.rb.erb (1 hunks)
🔇 Additional comments (2)
lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb (1)

18-23: LGTM! Whitespace improvements address RuboCop offenses.

The blank lines added around the server configuration section and removal of trailing whitespace correctly address the Layout/TrailingWhitespace offenses mentioned in the PR description. These changes improve code organization by visually separating the logger configuration from server configuration sections.

lib/generators/cypress_on_rails/templates/spec/e2e/e2e_helper.rb.erb (1)

31-38: LGTM! Indentation normalized to Ruby standard.

The indentation of the SmartFactoryWrapper.configure block has been correctly adjusted from 4 spaces to the Ruby standard of 2 spaces. This addresses the Layout/IndentationWidth offenses reported by RuboCop in the PR description.


Comment @coderabbitai help to get the list of available commands and usage tips.

@justin808
Copy link
Member

@claude review this PR

@claude
Copy link

claude bot commented Oct 23, 2025

Claude encountered an error —— View job

Failed with exit code 128

I'll analyze this and get back to you.

@justin808 justin808 merged commit d1662ca into shakacode:master Oct 23, 2025
6 of 10 checks passed
@justin808
Copy link
Member

@tnir Thanks! Appreciate it!

@tnir tnir deleted the tnir-fix-rubocop-lints branch October 25, 2025 16:29
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