ManageIQ/manageiq

View on GitHub
lib/extensions/ar_adapter.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Remove redundant sort.
Open

Dir.glob(File.expand_path(File.join(__dir__, "ar_adapter", "*.rb"))).sort.each { |f| require f }
Severity: Minor
Found in lib/extensions/ar_adapter.rb by rubocop

Sort globbed results by default in Ruby 3.0. This cop checks for redundant sort method to Dir.glob and Dir[].

Safety:

This cop is unsafe, in case of having a file and a directory with identical names, since directory will be loaded before the file, which will break exe/files.rb that rely on exe.rb file.

Example:

# bad
Dir.glob('./lib/**/*.rb').sort.each do |file|
end

Dir['./lib/**/*.rb'].sort.each do |file|
end

# good
Dir.glob('./lib/**/*.rb').each do |file|
end

Dir['./lib/**/*.rb'].each do |file|
end

There are no issues that match your filters.

Category
Status