From e3968e9d87dd0d9edd23c0c091fc42c1c38d2844 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 21 Sep 2024 14:20:55 +0200 Subject: [PATCH] Prefer `require_relative` for internal requires `require_relative` is preferred over `require` for files within the same project because it uses paths relative to the current file, making code more portable and less dependent on the load path. This change updates internal requires to use `require_relative` for consistency, performance, and improved portability. Refs: - rubocop/rubocop#8748 --- lib/pundit.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/pundit.rb b/lib/pundit.rb index a03f4d3a..8f512d92 100644 --- a/lib/pundit.rb +++ b/lib/pundit.rb @@ -1,16 +1,18 @@ # frozen_string_literal: true -require "pundit/version" -require "pundit/policy_finder" +require_relative "pundit/version" +require_relative "pundit/policy_finder" + require "active_support/concern" require "active_support/core_ext/string/inflections" require "active_support/core_ext/object/blank" require "active_support/core_ext/module/introspection" require "active_support/dependencies/autoload" -require "pundit/authorization" -require "pundit/context" -require "pundit/cache_store/null_store" -require "pundit/cache_store/legacy_store" + +require_relative "pundit/authorization" +require_relative "pundit/context" +require_relative "pundit/cache_store/null_store" +require_relative "pundit/cache_store/legacy_store" # @api private # To avoid name clashes with common Error naming when mixing in Pundit,