Skip to content

Commit

Permalink
[Fix rubocop#79] Rubocop::Cop::Rails constant removal
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rmm5t committed Jun 25, 2019
1 parent 4712f51 commit da9759b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bug fixes

* [#43](https://github.com/rubocop-hq/rubocop-rails/issues/43): Remove `change_column_null` method from `BulkChangeTable` cop offenses. ([@anthony-robin][])
* [#79](https://github.com/rubocop-hq/rubocop-rails/issues/79): Fix `RuboCop::Cop::Rails not defined (NameError)`. ([@rmm5t][])

### Changes

Expand All @@ -27,3 +28,4 @@
[@andyw8]: https://github.com/andyw8
[@buehmann]: https://github.com/buehmann
[@anthony-robin]: https://github.com/anthony-robin
[@rmm5t]: https://github.com/rmm5t
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rails_cops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module RuboCop
# RuboCop included the Rails cops directly before version 1.0.0.
# We can remove them to avoid warnings about redefining constants.
module Cop
remove_const('Rails') if const_defined?('Rails')
remove_const('Rails') if const_defined?('Rails', false)
end
end

Expand Down

0 comments on commit da9759b

Please sign in to comment.