crowbar/crowbar-client

View on GitHub

Showing 44 of 143 total issues

Method execute has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Open

          def execute
            request.process do |request|
              case request.code
              when 200
                hint = ""
Severity: Minor
Found in lib/crowbar/client/command/upgrade/repocheck.rb - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File node.rb has 398 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Crowbar
  module Client
    module App
      #
      # A Thor based CLI wrapper for node commands
Severity: Minor
Found in lib/crowbar/client/app/node.rb - About 5 hrs to fix

File upgrade.rb has 335 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Crowbar
  module Client
    module App
      #
      # A Thor based CLI wrapper for upgrade commands
Severity: Minor
Found in lib/crowbar/client/app/upgrade.rb - About 4 hrs to fix

File proposal.rb has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Crowbar
  module Client
    module App
      #
      # A Thor based CLI wrapper for proposal commands
Severity: Minor
Found in lib/crowbar/client/app/proposal.rb - About 3 hrs to fix

Class Config has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Config
      include Singleton

      attr_writer :options
      attr_writer :config
Severity: Minor
Found in lib/crowbar/client/config.rb - About 3 hrs to fix

Method execute has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def execute
            request.process do |request|
              case request.code
              when 200
                hint = ""
Severity: Major
Found in lib/crowbar/client/command/upgrade/repocheck.rb - About 2 hrs to fix

Method execute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

          def execute
            request.process do |request|
              case request.code
              when 200
                formatter = Formatter::Hash.new(
Severity: Minor
Found in lib/crowbar/client/command/upgrade/prechecks.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method process_hash has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def process_hash(values, path = "", type = :table)
          [].tap do |result|
            values.map do |key, value|
              new_path = [path.to_s.dup, key].reject(&:empty?).join(".")

Severity: Minor
Found in lib/crowbar/client/formatter/nested.rb - About 1 hr to fix

Method execute has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def execute
            validate_barclamp! args.barclamp

            request.process do |request|
              case request.code
Severity: Minor
Found in lib/crowbar/client/command/proposal/show.rb - About 1 hr to fix

Method content_from has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def content_from(request)
            result = [].tap do |row|
              request.parsed_response["nodes"].each do |child|
                if options["meta"]
                  row.push(
Severity: Minor
Found in lib/crowbar/client/command/node/list.rb - About 1 hr to fix

Method execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

          def execute
            validate_barclamp! args.barclamp

            request.process do |request|
              case request.code
Severity: Minor
Found in lib/crowbar/client/command/proposal/show.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method from_file has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def from_file
            json = begin
              file = File.read(
                options[:file]
              )
Severity: Minor
Found in lib/crowbar/client/command/proposal/create.rb - About 1 hr to fix

Method execute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def execute
            request.process do |request|
              case request.code
              when 200
                if args.component == "crowbar"
Severity: Minor
Found in lib/crowbar/client/command/upgrade/backup.rb - About 1 hr to fix

Method execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def execute
            request.process do |request|
              case request.code
              when 200
                if args.component == "crowbar"
Severity: Minor
Found in lib/crowbar/client/command/upgrade/backup.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def execute
            unless ["normal", "non_disruptive", nil].include? args.mode
              err "Invalid upgrade mode '#{args.mode}'. " \
                  "Only 'normal' and 'non_disruptive' are valid upgrade modes"
            end
Severity: Minor
Found in lib/crowbar/client/command/upgrade/mode.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method check_nodes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def check_nodes(configuration)
            invalid_nodes = []
            nodes_and_clusters = valid_elements

            configuration["deployment"].each do |service_name, service|
Severity: Minor
Found in lib/crowbar/client/command/proposal/edit.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method process_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def process_hash(values, path = "", type = :table)
          [].tap do |result|
            values.map do |key, value|
              new_path = [path.to_s.dup, key].reject(&:empty?).join(".")

Severity: Minor
Found in lib/crowbar/client/formatter/nested.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def initialize(stdin, stdout, stderr, options = {}, args = {})
Severity: Minor
Found in lib/crowbar/client/command/base.rb - About 35 mins to fix

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

          argv,
          stdin = STDIN,
          stdout = STDOUT,
          stderr = STDERR,
          kernel = Kernel
Severity: Minor
Found in lib/crowbar/client/util/runner.rb - About 35 mins to fix

Method allocate has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def allocate(proposal, node, network, range, suggestion = nil)
Severity: Minor
Found in lib/crowbar/client/app/host_ip.rb - About 35 mins to fix
Severity
Category
Status
Source
Language