davidbegin/downup

View on GitHub
lib/downup/base.rb

Summary

Maintainability
A
20 mins
Test Coverage

Class has too many lines. [149/100]
Open

  class Base
    attr_reader :selected_position

    # @param options [Hash|Array] collection of options to choose from
    # @param flash_message [String] A message to be displayed above the downup menu
Severity: Minor
Found in lib/downup/base.rb by rubocop

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

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

    def prompt(position = 0)
      @selected_position = position_selector(position)
      colonel.system("clear")
      header_proc.call
      print_flash
Severity: Minor
Found in lib/downup/base.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.

Assignment Branch Condition size for execute_selection is too high. [22.36/15]
Open

    def execute_selection(input)
      case options
      when Array
        options[selected_position]
      when Hash
Severity: Minor
Found in lib/downup/base.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. [16/10]
Open

    def execute_selection(input)
      case options
      when Array
        options[selected_position]
      when Hash
Severity: Minor
Found in lib/downup/base.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.

Assignment Branch Condition size for prompt is too high. [19.1/15]
Open

    def prompt(position = 0)
      @selected_position = position_selector(position)
      colonel.system("clear")
      header_proc.call
      print_flash
Severity: Minor
Found in lib/downup/base.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 initialize(options:,
                   flash_message:         nil,
                   flash_color:           :green,
                   default_color:         :brown,
                   selected_color:        :magenta,
Severity: Minor
Found in lib/downup/base.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 process_input(input)
      case input
      when "\e[A", "k"
        prompt(selected_position - 1)
      when "\e[B", "j"
Severity: Minor
Found in lib/downup/base.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.

Assignment Branch Condition size for process_input is too high. [17.09/15]
Open

    def process_input(input)
      case input
      when "\e[A", "k"
        prompt(selected_position - 1)
      when "\e[B", "j"
Severity: Minor
Found in lib/downup/base.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 read_char is too high. [16.55/15]
Open

    def read_char
      stdin.echo = false
      stdin.raw!
      input = stdin.getc.chr
      if input == "\e" then
Severity: Minor
Found in lib/downup/base.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

Cyclomatic complexity for process_input is too high. [7/6]
Open

    def process_input(input)
      case input
      when "\e[A", "k"
        prompt(selected_position - 1)
      when "\e[B", "j"
Severity: Minor
Found in lib/downup/base.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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

    def read_char
      stdin.echo = false
      stdin.raw!
      input = stdin.getc.chr
      if input == "\e" then
Severity: Minor
Found in lib/downup/base.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. [11/5]
Open

    def initialize(options:,
                   flash_message:         nil,
                   flash_color:           :green,
                   default_color:         :brown,
                   selected_color:        :magenta,
Severity: Minor
Found in lib/downup/base.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.

Place when conditions with a splat at the end of the when branches.
Open

      when *option_keys
Severity: Minor
Found in lib/downup/base.rb by rubocop

Place when conditions that use splat at the end of the list of when branches.

Ruby has to allocate memory for the splat expansion every time that the case when statement is run. Since Ruby does not support fall through inside of case when, like some other languages do, the order of the when branches does not matter. By placing any splat expansions at the end of the list of when branches we will reduce the number of times that memory has to be allocated for the expansion.

This is not a guaranteed performance improvement. If the data being processed by the case condition is normalized in a manner that favors hitting a condition in the splat expansion, it is possible that moving the splat condition to the end will use more memory, and run slightly slower.

Example:

# bad
case foo
when *condition
  bar
when baz
  foobar
end

case foo
when *[1, 2, 3, 4]
  bar
when 5
  baz
end

# good
case foo
when baz
  foobar
when *condition
  bar
end

case foo
when 1, 2, 3, 4
  bar
when 5
  baz
end

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/base.rb and 1 other location - About 20 mins to fix
lib/downup/options_printer.rb on lines 103..109

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

Unused method argument - input. If it's necessary, use _ or _input as an argument name to indicate that it won't be used. You can also write as execute_selection(*) if you want the method to accept any arguments but don't care about them.
Open

    def execute_selection(input)
Severity: Minor
Found in lib/downup/base.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

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

      options.values.all? { |option|
Severity: Minor
Found in lib/downup/base.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("-")

Space inside } missing.
Open

            @options.merge({"z" => "ENTER"})
Severity: Minor
Found in lib/downup/base.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Do not return from an ensure block.
Open

      return input
Severity: Minor
Found in lib/downup/base.rb by rubocop

This cop checks for return from an ensure block.

Example:

# bad

begin
  do_something
ensure
  do_something_else
  return
end

Example:

# good

begin
  do_something
ensure
  do_something_else
end

Use proc instead of Proc.new.
Open

                   header_proc:           Proc.new{})
Severity: Minor
Found in lib/downup/base.rb by rubocop

This cops checks for uses of Proc.new where Kernel#proc would be more appropriate.

Example:

# bad
p = Proc.new { |n| puts n }

# good
p = proc { |n| puts n }

Line is too long. [83/80]
Open

    # @param flash_message [String] A message to be displayed above the downup menu
Severity: Minor
Found in lib/downup/base.rb by rubocop

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

      } && options.values.all? { |option|
Severity: Minor
Found in lib/downup/base.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("-")

Redundant curly braces around a hash parameter.
Open

            @options.merge({"z" => "ENTER"})
Severity: Minor
Found in lib/downup/base.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

Convert if nested inside else to elsif.
Open

          if multi_select?
Severity: Minor
Found in lib/downup/base.rb by rubocop

If the else branch of a conditional consists solely of an if node, it can be combined with the else to become an elsif. This helps to keep the nesting level from getting too deep.

Example:

# bad
if condition_a
  action_a
else
  if condition_b
    action_b
  else
    action_c
  end
end

# good
if condition_a
  action_a
elsif condition_b
  action_b
else
  action_c
end

Do not use then for multi-line if.
Open

      if input == "\e" then
Severity: Minor
Found in lib/downup/base.rb by rubocop

Checks for uses of the then keyword in multi-line if statements.

Example:

# bad
# This is considered bad practice.
if cond then
end

# good
# If statements can contain `then` on the same line.
if cond then a
elsif cond then b
end

Space inside { missing.
Open

            @options.merge({"z" => "ENTER"})
Severity: Minor
Found in lib/downup/base.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Missing top-level module documentation comment.
Open

module Downup
Severity: Minor
Found in lib/downup/base.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

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

        option.is_a?(Hash) && option.has_key?("display")
Severity: Minor
Found in lib/downup/base.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?

Avoid using rescue in its modifier form.
Open

        input << stdin.read_nonblock(3) rescue nil
Severity: Minor
Found in lib/downup/base.rb by rubocop

This cop checks for uses of rescue in its modifier form.

Example:

# bad
some_method rescue handle_error

# good
begin
  some_method
rescue
  handle_error
end

Line is too long. [100/80]
Open

    # @param type [Symbol] single select/default or multi select mode, `:default` or `:multi_select`
Severity: Minor
Found in lib/downup/base.rb by rubocop

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

        option.is_a?(Hash) && option.has_key?("value")
Severity: Minor
Found in lib/downup/base.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?

Line is too long. [90/80]
Open

    # @param multi_select_selector [String] The charactor for selected items in multi mode
Severity: Minor
Found in lib/downup/base.rb by rubocop

Line is too long. [94/80]
Open

    # @param header_proc [Proc] a proc that will called before each render of option selection
Severity: Minor
Found in lib/downup/base.rb by rubocop

Line is too long. [86/80]
Open

    # @param selector [String] The charactor for the moving selector in non-multi mode
Severity: Minor
Found in lib/downup/base.rb by rubocop

Line is too long. [92/80]
Open

    #   Downup::Base.new(options: {"a" => {"value" => "option 1", "display" => "Option 1"}})
Severity: Minor
Found in lib/downup/base.rb by rubocop

Space missing to the left of {.
Open

                   header_proc:           Proc.new{})
Severity: Minor
Found in lib/downup/base.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

end at 185, 21 is not aligned with case at 182, 6.
Open

      else position; end
Severity: Minor
Found in lib/downup/base.rb by rubocop

This cop checks whether the end keywords are aligned properly.

Three modes are supported through the EnforcedStyleAlignWith configuration parameter:

If it's set to keyword (which is the default), the end shall be aligned with the start of the keyword (if, class, etc.).

If it's set to variable the end shall be aligned with the left-hand-side of the variable assignment, if there is one.

If it's set to start_of_line, the end shall be aligned with the start of the line where the matching keyword appears.

Example: EnforcedStyleAlignWith: keyword (default)

# bad

variable = if true
    end

# good

variable = if true
           end

Example: EnforcedStyleAlignWith: variable

# bad

variable = if true
    end

# good

variable = if true
end

Example: EnforcedStyleAlignWith: startofline

# bad

variable = if true
    end

# good

puts(if true
end)

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

      when "\e[B", "j"
Severity: Minor
Found in lib/downup/base.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.puts eval(colored_flash)
Severity: Minor
Found in lib/downup/base.rb by rubocop

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

Example:

# bad

eval(something)
binding.eval(something)

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

require_relative "version"
Severity: Minor
Found in lib/downup/base.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"

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

require "io/console"
Severity: Minor
Found in lib/downup/base.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"

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

          options.fetch(option_keys[selected_position]).fetch("value")
Severity: Minor
Found in lib/downup/base.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"

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

      when "\e[A", "k"
Severity: Minor
Found in lib/downup/base.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"

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/base.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"

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

                   multi_select_selector: "√",
Severity: Minor
Found in lib/downup/base.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"

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

      return execute_selection(input) if selected_value == "ENTER"
Severity: Minor
Found in lib/downup/base.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"

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/base.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"

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

require_relative "colors"
Severity: Minor
Found in lib/downup/base.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"

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

                   selector:              "‣",
Severity: Minor
Found in lib/downup/base.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"

Avoid comma after the last parameter of a method call.
Open

        stdout: stdout,
Severity: Minor
Found in lib/downup/base.rb by rubocop

This cop checks for trailing comma in argument lists.

Example: EnforcedStyleForMultiline: consistent_comma

# bad
method(1, 2,)

# good
method(
  1, 2,
  3,
)

# good
method(
  1,
  2,
)

Example: EnforcedStyleForMultiline: comma

# bad
method(1, 2,)

# good
method(
  1,
  2,
)

Example: EnforcedStyleForMultiline: no_comma (default)

# bad
method(1, 2,)

# good
method(
  1,
  2
)

Avoid using rescue in its modifier form.
Open

        input << stdin.read_nonblock(2) rescue nil
Severity: Minor
Found in lib/downup/base.rb by rubocop

This cop checks for uses of rescue in its modifier form.

Example:

# bad
some_method rescue handle_error

# good
begin
  some_method
rescue
  handle_error
end

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

      colonel.system("clear")
Severity: Minor
Found in lib/downup/base.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"

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

            @options.merge({"z" => "ENTER"})
Severity: Minor
Found in lib/downup/base.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"

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

            @options.merge({"z" => "ENTER"})
Severity: Minor
Found in lib/downup/base.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"

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

require_relative "options_printer"
Severity: Minor
Found in lib/downup/base.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"

There are no issues that match your filters.

Category
Status