Skip to content

Commit

Permalink
Prefer require_relative for internal requires
Browse files Browse the repository at this point in the history
`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.

Ref:
- rubocop/rubocop#8748
  • Loading branch information
tagliala committed Sep 20, 2024
1 parent a9a6417 commit 58f4dd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/hawk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
require 'active_support/core_ext/hash/deep_merge'
require 'active_support/core_ext/object/blank'

require 'hawk/version'
require_relative 'hawk/version'

require 'hawk/error'
require 'hawk/http'
require 'hawk/model'
require_relative 'hawk/error'
require_relative 'hawk/http'
require_relative 'hawk/model'
4 changes: 2 additions & 2 deletions lib/hawk/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module Hawk
require 'typhoeus'
require 'multi_json'

require 'hawk/http/caching'
require 'hawk/http/instrumentation'
require_relative 'http/caching'
require_relative 'http/instrumentation'

##
# Represent an HTTP connector, to be linked to a {Model}.
Expand Down

0 comments on commit 58f4dd8

Please sign in to comment.