davidbegin/downup

View on GitHub
lib/downup/options_printer.rb

Summary

Maintainability
A
20 mins
Test Coverage

Assignment Branch Condition size for print_simple_hash_options is too high. [28.07/15]
Open

    def print_simple_hash_options
      options.each_with_index do |option_array, index|
        if index == selected_position
          stdout.puts "(#{eval("selector.#{selected_color}")}) " +
            eval("option_array.last.#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for print_complex_hash_options is too high. [21.12/15]
Open

    def print_complex_hash_options
      options.each_with_index do |option_array, index|
        key = option_array.first
        value_hash = option_array.last
        if index == selected_position
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [13/10]
Open

    def print_complex_hash_options
      options.each_with_index do |option_array, index|
        key = option_array.first
        value_hash = option_array.last
        if index == selected_position
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [12/10]
Open

    def print_simple_hash_options
      options.each_with_index do |option_array, index|
        if index == selected_position
          stdout.puts "(#{eval("selector.#{selected_color}")}) " +
            eval("option_array.last.#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [11/10]
Open

    def initialize(options:,
                   selected_position: 0,
                   default_color: :brown,
                   selected_color: :magenta,
                   selector: "‣",
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Avoid parameter lists longer than 5 parameters. [10/5]
Open

    def initialize(options:,
                   selected_position: 0,
                   default_color: :brown,
                   selected_color: :magenta,
                   selector: "‣",
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    def options_has_value_and_display?
      options.values.all? { |option|
        option.is_a?(Hash) && option.has_key?("value")
      } && options.values.all? { |option|
        option.is_a?(Hash) && option.has_key?("display")
Severity: Minor
Found in lib/downup/options_printer.rb and 1 other location - About 20 mins to fix
lib/downup/base.rb on lines 169..175

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 27.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

        option.is_a?(Hash) && option.has_key?("display")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Use Hash#key? instead of Hash#has_key?.
Open

        option.is_a?(Hash) && option.has_key?("display")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop (by default) checks for uses of methods Hash#haskey? and Hash#hasvalue? where it enforces Hash#key? and Hash#value? It is configurable to enforce the inverse, using verbose method names also.

Example: EnforcedStyle: short (default)

# bad Hash#haskey? Hash#hasvalue?

# good Hash#key? Hash#value?

Example: EnforcedStyle: verbose

# bad Hash#key? Hash#value?

# good Hash#haskey? Hash#hasvalue?

Unused method argument - option. If it's necessary, use _ or _option as an argument name to indicate that it won't be used.
Open

    def colorize_option(option, index)
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Useless assignment to variable - value_hash.
Open

        value_hash = option_array.last
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

assigned but unused variable - foo

Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

Example:

# bad

def some_method
  some_var = 1
  do_something
end

Example:

# good

def some_method
  some_var = 1
  do_something(some_var)
end

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

            eval("option_array.last.#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

The use of eval is a serious security risk.
Open

        eval("option.#{default_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

            eval("value_hash.fetch('display').#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

            eval("option_array.last.#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

Align the operands of an expression spanning multiple lines.
Open

            eval("value_hash.fetch('display').#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks the indentation of the right hand side operand in binary operations that span more than one line.

Example:

# bad
if a +
b
  something
end

# good
if a +
   b
  something
end

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

        eval("option.#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

        eval("option.#{default_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

Useless assignment to variable - key.
Open

        key = option_array.first
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

assigned but unused variable - foo

Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

Example:

# bad

def some_method
  some_var = 1
  do_something
end

Example:

# good

def some_method
  some_var = 1
  do_something(some_var)
end

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

                   multi_select_selector: "√",
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

The use of eval is a serious security risk.
Open

            eval("value_hash.fetch('display').#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

          stdout.puts "(#{eval("multi_select_selector.#{selected_color}")}) " +
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

          stdout.print "#{eval("option_array.last.#{default_color}")}\n"
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

The use of eval is a serious security risk.
Open

          stdout.puts "(#{eval("selector.#{selected_color}")}) " +
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

Align the operands of an expression spanning multiple lines.
Open

            eval("option_array.last.#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks the indentation of the right hand side operand in binary operations that span more than one line.

Example:

# bad
if a +
b
  something
end

# good
if a +
   b
  something
end

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

            "#{eval("value_hash.fetch('display').#{default_color}")}\n"
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

The use of eval is a serious security risk.
Open

          stdout.puts "(#{eval("selector.#{selected_color}")}) " +
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

The use of eval is a serious security risk.
Open

          stdout.puts "(#{eval("multi_select_selector.#{selected_color}")}) " +
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

Avoid using {...} for multi-line blocks.
Open

      } && options.values.all? { |option|
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

Check for uses of braces or do/end around single line or multi-line blocks.

Example: EnforcedStyle: linecountbased (default)

# bad - single line block
items.each do |item| item / 5 end

# good - single line block
items.each { |item| item / 5 }

# bad - multi-line block
things.map { |thing|
  something = thing.some_method
  process(something)
}

# good - multi-line block
things.map do |thing|
  something = thing.some_method
  process(something)
end

Example: EnforcedStyle: semantic

# Prefer `do...end` over `{...}` for procedural blocks.

# return value is used/assigned
# bad
foo = map do |x|
  x
end
puts (map do |x|
  x
end)

# return value is not used out of scope
# good
map do |x|
  x
end

# Prefer `{...}` over `do...end` for functional blocks.

# return value is not used out of scope
# bad
each { |x|
  x
}

# return value is used/assigned
# good
foo = map { |x|
  x
}
map { |x|
  x
}.inspect

Example: EnforcedStyle: bracesforchaining

# bad
words.each do |word|
  word.flip.flop
end.join("-")

# good
words.each { |word|
  word.flip.flop
}.join("-")

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

                   selector: "‣",
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

The use of eval is a serious security risk.
Open

          stdout.print "#{eval("option_array.last.#{default_color}")}\n"
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

Use Hash#key? instead of Hash#has_key?.
Open

        option.is_a?(Hash) && option.has_key?("value")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop (by default) checks for uses of methods Hash#haskey? and Hash#hasvalue? where it enforces Hash#key? and Hash#value? It is configurable to enforce the inverse, using verbose method names also.

Example: EnforcedStyle: short (default)

# bad Hash#haskey? Hash#hasvalue?

# good Hash#key? Hash#value?

Example: EnforcedStyle: verbose

# bad Hash#key? Hash#value?

# good Hash#haskey? Hash#hasvalue?

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

        option.is_a?(Hash) && option.has_key?("value")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

The use of eval is a serious security risk.
Open

          stdout.print "(#{eval("key.#{default_color}")}) "
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

The use of eval is a serious security risk.
Open

            eval("option_array.last.#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

The use of eval is a serious security risk.
Open

          stdout.print "(#{eval("option_array.first.#{default_color}")}) "
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

Unused block argument - option_array. If it's necessary, use _ or _option_array as an argument name to indicate that it won't be used.
Open

      options.each_with_index do |option_array, index|
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Avoid using {...} for multi-line blocks.
Open

      options.values.all? { |option|
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

Check for uses of braces or do/end around single line or multi-line blocks.

Example: EnforcedStyle: linecountbased (default)

# bad - single line block
items.each do |item| item / 5 end

# good - single line block
items.each { |item| item / 5 }

# bad - multi-line block
things.map { |thing|
  something = thing.some_method
  process(something)
}

# good - multi-line block
things.map do |thing|
  something = thing.some_method
  process(something)
end

Example: EnforcedStyle: semantic

# Prefer `do...end` over `{...}` for procedural blocks.

# return value is used/assigned
# bad
foo = map do |x|
  x
end
puts (map do |x|
  x
end)

# return value is not used out of scope
# good
map do |x|
  x
end

# Prefer `{...}` over `do...end` for functional blocks.

# return value is not used out of scope
# bad
each { |x|
  x
}

# return value is used/assigned
# good
foo = map { |x|
  x
}
map { |x|
  x
}.inspect

Example: EnforcedStyle: bracesforchaining

# bad
words.each do |word|
  word.flip.flop
end.join("-")

# good
words.each { |word|
  word.flip.flop
}.join("-")

Missing top-level class documentation comment.
Open

  class OptionsPrinter
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

          stdout.print "(#{eval("key.#{default_color}")}) "
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

          stdout.puts "(#{eval("selector.#{selected_color}")}) " +
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

require_relative "colors"
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

The use of eval is a serious security risk.
Open

            "#{eval("value_hash.fetch('display').#{default_color}")}\n"
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

The use of eval is a serious security risk.
Open

            eval("option_array.last.#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

Align the operands of an expression spanning multiple lines.
Open

            eval("option_array.last.#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks the indentation of the right hand side operand in binary operations that span more than one line.

Example:

# bad
if a +
b
  something
end

# good
if a +
   b
  something
end

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

          stdout.puts "(#{eval("selector.#{selected_color}")}) " +
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

          stdout.print "(#{eval("option_array.first.#{default_color}")}) "
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

The use of eval is a serious security risk.
Open

        eval("option.#{selected_color}")
Severity: Minor
Found in lib/downup/options_printer.rb by rubocop

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

There are no issues that match your filters.

Category
Status