cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub
bosh_cli/lib/cli/commands/misc.rb

Summary

Maintainability
D
2 days
Test Coverage

Method status has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def status
      if options[:uuid]
        begin
          say(get_director_status["uuid"])
        rescue => e
Severity: Minor
Found in bosh_cli/lib/cli/commands/misc.rb - About 4 hrs 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 status has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def status
      if options[:uuid]
        begin
          say(get_director_status["uuid"])
        rescue => e
Severity: Major
Found in bosh_cli/lib/cli/commands/misc.rb - About 2 hrs to fix

    File misc.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Bosh::Cli::Command
      class Misc < Base
        DEFAULT_STATUS_TIMEOUT = 3 # seconds
    
        # bosh version
    Severity: Minor
    Found in bosh_cli/lib/cli/commands/misc.rb - About 2 hrs to fix

      Method set_target has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def set_target(director_url = nil, name = nil)
            if director_url.nil?
              show_target
              return
            end
      Severity: Minor
      Found in bosh_cli/lib/cli/commands/misc.rb - About 1 hr to fix

        Method login has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def login(username = nil, password = nil)
              target_required
        
              if interactive?
                username = ask("Your username: ").to_s if username.blank?
        Severity: Minor
        Found in bosh_cli/lib/cli/commands/misc.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 set_target has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_target(director_url = nil, name = nil)
              if director_url.nil?
                show_target
                return
              end
        Severity: Minor
        Found in bosh_cli/lib/cli/commands/misc.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 login has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def login(username = nil, password = nil)
              target_required
        
              if interactive?
                username = ask("Your username: ").to_s if username.blank?
        Severity: Minor
        Found in bosh_cli/lib/cli/commands/misc.rb - About 1 hr to fix

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

              def show_target
                if config.target
                  if interactive?
                    if config.target_name
                      name = "#{config.target} (#{config.target_name})"
          Severity: Minor
          Found in bosh_cli/lib/cli/commands/misc.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 print_feature_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def print_feature_list(features)
                if features.respond_to?(:each)
                  features.each do |feature, info|
                    # Old director only returns status as a Boolean
                    if info.kind_of?(Hash)
          Severity: Minor
          Found in bosh_cli/lib/cli/commands/misc.rb - About 25 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

          There are no issues that match your filters.

          Category
          Status