Skip to content

Commit

Permalink
[Fix #10893] Fix an error when running rubocop without bundle exec
Browse files Browse the repository at this point in the history
Fixes #10893.

This PR fixes an error when running `rubocop` without `bundle exec`.
  • Loading branch information
koic authored and bbatsov committed Aug 9, 2022
1 parent 95e919d commit a133796
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/fix_an_error_for_no_bundle_exec.md
@@ -0,0 +1 @@
* [#10893](https://github.com/rubocop/rubocop/issues/10893): Fix an error when running `rubocop` without `bundle exec`. ([@koic][])
4 changes: 3 additions & 1 deletion lib/rubocop/feature_loader.rb
Expand Up @@ -30,7 +30,9 @@ def initialize(config_directory_path:, feature:)
end

def load
::Kernel.require(target)
# Don't use `::Kernel.require(target)` to prevent the following error:
# https://github.com/rubocop/rubocop/issues/10893
require(target)
rescue ::LoadError => e
raise if e.path != target

Expand Down

0 comments on commit a133796

Please sign in to comment.