You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Rails/MigrationClassName cop should only trigger on the top level class in a migration.
Actual behavior
The Rails/MigrationClassName cop triggers on the inner classes in a migration.
Steps to reproduce the problem
Consider this example:
class AddEmailValid < ActiveRecord::Migration[4.2]
class User < ApplicationRecord
end
def self.up
add_column "users", "email_valid", :boolean, :default => false, :null => false
User.update_all("email_valid = (active != 0)") # email_valid is :boolean, but active is :integer. "email_valid = active" (see r11802 or earlier) will fail for stricter dbs than mysql
end
def self.down
remove_column "users", "email_valid"
end
end
with rubocop-rails 2.14.0 the inner User class is renamed to AddEmailValid.
Expected behavior
The
Rails/MigrationClassName
cop should only trigger on the top level class in a migration.Actual behavior
The
Rails/MigrationClassName
cop triggers on the inner classes in a migration.Steps to reproduce the problem
Consider this example:
with rubocop-rails 2.14.0 the inner
User
class is renamed toAddEmailValid
.RuboCop version
1.26.0 (using Parser 3.1.1.0, rubocop-ast 1.16.0, running on ruby 3.0.2 x86_64-linux)
The text was updated successfully, but these errors were encountered: