Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails/MigrationClassName triggers on inner classes #671

Closed
mkllnk opened this issue Mar 16, 2022 · 2 comments
Closed

Rails/MigrationClassName triggers on inner classes #671

mkllnk opened this issue Mar 16, 2022 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@mkllnk
Copy link

mkllnk commented Mar 16, 2022

This is a repeat of #659 which should have been fixed by #657 but wasn't.

Expected behavior

Describe here how you expected RuboCop Rails to behave in this particular situation.

Actual behavior

Describe here what actually happened.

db/migrate/20190911042535_remove_trials.rb:2:9: C: [Correctable] Rails/MigrationClassName: Replace with RemoveTrials that matches the file name.
  class Trial < ActiveRecord::Base
        ^^^^^
--- a/db/migrate/20190911042535_remove_trials.rb
+++ b/db/migrate/20190911042535_remove_trials.rb
@@ -1,5 +1,5 @@
 class RemoveTrials < ActiveRecord::Migration
-  class Trial < ActiveRecord::Base
+  class RemoveTrials < ActiveRecord::Base
   end
 
   def up

Steps to reproduce the problem

Run the cop on this migration file:

# db/migrate/20190911042535_remove_trials.rb
class RemoveTrials < ActiveRecord::Migration
  class Trial < ActiveRecord::Base
  end

  def up
    #testing
  end

  def down
    #testing
  end
end

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler. Here's an example:
You can see extension cop versions (e.g. rubocop-rails, rubocop-performance, and others) output by rubocop -V,
include them as well. Here's an example:

$ [bundle exec] rubocop -V
1.26.0 (using Parser 3.1.1.0, rubocop-ast 1.16.0, running on ruby 2.5.9 x86_64-linux)
  - rubocop-rails 2.14.1
@koic koic added the duplicate This issue or pull request already exists label Mar 17, 2022
@koic
Copy link
Member

koic commented Mar 17, 2022

This issue has been resolved by #663. The next bugfix release (2.14.2) will be coming soon. Thank you for the feedback.

@koic koic closed this as completed Mar 17, 2022
@koic
Copy link
Member

koic commented Mar 18, 2022

FYI, RuboCop Rails 2.14.2 has been released:
https://github.com/rubocop/rubocop-rails/releases/tag/v2.14.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants