diff --git a/changelog/fix_an_error_for_no_bundle_exec.md b/changelog/fix_an_error_for_no_bundle_exec.md new file mode 100644 index 00000000000..b5ee5d65dfb --- /dev/null +++ b/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][]) diff --git a/lib/rubocop/feature_loader.rb b/lib/rubocop/feature_loader.rb index 32317a18451..e80fe0fbcab 100644 --- a/lib/rubocop/feature_loader.rb +++ b/lib/rubocop/feature_loader.rb @@ -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