-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Closed
Labels
Description
Empty scaffolding produces code that doesn't conform to rubocop-rails-omakase requirements.
While empty scaffolding may seem odd, it is not unusual to have an object like a Cart which has a relationship with Products through a LineItems relationship object.
Steps to reproduce
Since rails new --edge
may pick up 7.1, I've provided reproduction instructions in the form of a dockerfile:
FROM ruby:3.3.3-slim
RUN apt-get update -qq && \
apt-get install -y build-essential git
RUN gem install rails -v 7.2.0.beta2 --pre
RUN rails new demo
WORKDIR demo
RUN bin/rails generate scaffold Cart
RUN rubocop
CMD sleep infinity
Expected behavior
38 files inspected, no offenses detected
Actual behavior
2.990 Inspecting 38 files
2.990 ..............................C...C...
2.990
2.990 Offenses:
2.990
2.990 db/migrate/20240619194019_create_carts.rb:4:1: C: [Correctable] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning.
2.990 test/controllers/carts_controller_test.rb:20:40: C: [Correctable] Layout/SpaceInsideHashLiteralBraces: Space inside empty hash literal braces detected.
2.990 post carts_url, params: { cart: { } }
2.990 ^^
2.990 test/controllers/carts_controller_test.rb:37:45: C: [Correctable] Layout/SpaceInsideHashLiteralBraces: Space inside empty hash literal braces detected.
2.990 patch cart_url(@cart), params: { cart: { } }
2.990 ^^
2.990
2.990 38 files inspected, 3 offenses detected, 3 offenses autocorrectable
System configuration
Rails version: 7.2.0-beta2
Ruby version: 3.3.3