sumoners/dm_courier

View on GitHub
lib/dm_courier/configurable.rb

Summary

Maintainability
A
0 mins
Test Coverage

Use each_key instead of keys.each.
Open

      DMCourier::Configurable.keys.each do |key|
Severity: Minor
Found in lib/dm_courier/configurable.rb by rubocop

This cop checks for uses of each_key and each_value Hash methods.

Note: If you have an array of two-element arrays, you can put parentheses around the block arguments to indicate that you're not working with a hash, and suppress RuboCop offenses.

Example:

# bad
hash.keys.each { |k| p k }
hash.values.each { |v| p v }
hash.each { |k, _v| p k }
hash.each { |_k, v| p v }

# good
hash.each_key { |k| p k }
hash.each_value { |v| p v }

Use %i or %I for an array of symbols.
Open

        @keys ||= [:api_key, :service_name, :async, :auto_html, :auto_text, :important,
                   :inline_css, :track_clicks, :track_opens, :track_url_without_query_string,
                   :log_content, :bcc_address, :return_path_domain, :signing_domain,
                   :subaccount, :tracking_domain, :tags, :from, :return_response, :ip_pool,
                   :campaign_id]
Severity: Minor
Found in lib/dm_courier/configurable.rb by rubocop

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

There are no issues that match your filters.

Category
Status