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

RuboCop::Cop::Rails not defined (NameError) #79

Closed
rmm5t opened this issue Jun 25, 2019 · 1 comment · Fixed by #80
Closed

RuboCop::Cop::Rails not defined (NameError) #79

rmm5t opened this issue Jun 25, 2019 · 1 comment · Fixed by #80

Comments

@rmm5t
Copy link
Contributor

rmm5t commented Jun 25, 2019

When rubocop-rails is loaded before Rails is loaded in conjunction with the latest rubocop 0.72, the following error occurs:

rubocop-rails-2.0.1/lib/rubocop/cop/rails_cops.rb:9:in 'remove_const': constant RuboCop::Cop::Rails not defined (NameError)

RuboCop version

0.72.0 (using Parser 2.6.3.0, running on ruby 2.5.3 x86_64-darwin18)


I'm working on a PR to fix this now...

rmm5t added a commit to rmm5t/rubocop-rails that referenced this issue Jun 25, 2019
Before, it attempted to remove the constant whether Rubocop::Cop::Rails was
defined or if ::Rails was defined. Turning off the inherit flag while checking
const_defined? remedies this.
@koic koic closed this as completed in #80 Jun 25, 2019
koic added a commit that referenced this issue Jun 25, 2019
[Fix #79] Rubocop::Cop::Rails constant removal
@ecbrodie
Copy link

I just ran into this. I'm very happy to see a fix quickly pushed to rubygems. Thank you :D

koic added a commit to koic/rubocop-rails that referenced this issue Jun 27, 2019
Follow up rubocop#80.
(Thank you for this PR that solved issue rubocop#79 early.)

Rails cops has been removed from RuboCop 0.72.
https://github.com/rubocop-hq/rubocop/releases/tag/v0.72.0

As a result of verification, the code to guard a warning is not
necessary already.
KPobeeNorris added a commit to ministryofjustice/prison-visits-2 that referenced this issue Jun 27, 2019
Updated rubocop-rails to fix issue reported here:
rubocop/rubocop-rails#79.
Also, appeased the linter in general!
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 a pull request may close this issue.

2 participants