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 19, 2024
1 parent 0d84426 commit a0b1a59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/client_side_validations/simple_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

require 'simple_form'
require 'client_side_validations'
require 'client_side_validations/simple_form/form_builder'

require_relative 'simple_form/form_builder'

if defined?(Rails)
require 'client_side_validations/simple_form/engine'
require 'client_side_validations/generators/simple_form'
require_relative 'simple_form/engine'
require_relative 'generators/simple_form'
end
2 changes: 1 addition & 1 deletion test/javascript/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def call(env)
use AssetPath, urls: ['/vendor/assets/javascripts'], root: rails_validations_path.full_gem_path

DEFAULT_JQUERY_VERSION = '3.7.1.slim'
QUNIT_VERSION = '2.21.0'
QUNIT_VERSION = '2.22.0'

helpers do
def jquery_version
Expand Down

0 comments on commit a0b1a59

Please sign in to comment.