ManageIQ/manageiq

View on GitHub
app/models/miq_region.rb

Summary

Maintainability
A
0 mins
Test Coverage
C
75%

Avoid immutable Array literals in loops. It is better to extract it into a local variable or a constant.
Open

    unless options.values.all? { |v| [true, false].include?(v) }
Severity: Minor
Found in app/models/miq_region.rb by rubocop

Use StandardError over Exception.
Open

      raise Exception, _("Region [%{region_id}] does not match the database's region [%{db_id}]") % {:region_id => my_region_id, :db_id => db_region_id}
Severity: Minor
Found in app/models/miq_region.rb by rubocop

Checks for raise or fail statements which are raising Exception class.

You can specify a module name that will be an implicit namespace using AllowedImplicitNamespaces option. The cop cause a false positive for namespaced Exception when a namespace is omitted. This option can prevent the false positive by specifying a namespace to be omitted for Exception. Alternatively, make Exception a fully qualified class name with an explicit namespace.

Safety:

This cop is unsafe because it will change the exception class being raised, which is a change in behavior.

Example:

# bad
raise Exception, 'Error message here'

# good
raise StandardError, 'Error message here'

Example: AllowedImplicitNamespaces: ['Gem']

# good
module Gem
  def self.foo
    raise Exception # This exception means `Gem::Exception`.
  end
end

There are no issues that match your filters.

Category
Status