chrisjones-tripletri/action_command

View on GitHub
lib/action_command/pretty_print_log_action.rb

Summary

Maintainability
A
0 mins
Test Coverage

Use each_value instead of each.
Open

      sequences.each do |_k, v|

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 the double pipe equals operator ||= instead.
Open

      @dest = STDOUT unless @dest

This cop checks for potential usage of the ||= operator.

Example:

# bad
name = name ? name : 'Bozhidar'

# bad
name = if name
         name
       else
         'Bozhidar'
       end

# bad
unless name
  name = 'Bozhidar'
end

# bad
name = 'Bozhidar' unless name

# good - set name to 'Bozhidar', only if it's nil or false
name ||= 'Bozhidar'

Method ActionCommand::PrettyPrintLogAction#dest is defined at both lib/action_command/pretty_print_log_action.rb:7 and lib/action_command/pretty_print_log_action.rb:19.
Open

    def dest

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end

There are no issues that match your filters.

Category
Status