davidbegin/downup

View on GitHub

Showing 220 of 220 total issues

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.

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

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 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

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. [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 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

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.

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.

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. [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.

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

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

Severity
Category
Status
Source
Language