cloudfoundry/cf

View on GitHub

Showing 96 of 102 total issues

Method delete_service has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def delete_service
      if input[:all]
        return unless input[:really, "ALL SERVICES", :bad]

        client.service_instances.each do |i|
Severity: Minor
Found in lib/cf/cli/service/delete.rb - About 1 hr to fix

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

        def show_instance_logs(app, i)
          return unless i.id
    
          logs =
            with_progress(
    Severity: Minor
    Found in lib/cf/cli/app/logs.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 prompt_user has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def prompt_user
            object_choices = choices
    
            if object_choices.empty?
              with_progress("There are no #{type}s. You may want to create one with #{c("create-#{type == :organization ? "org" : type}", :good)}.") {}
    Severity: Minor
    Found in lib/cf/cli/populators/populator_methods.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 parse_name_and_value! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_name_and_value!
          name = input[:name]
          value = input[:value]
    
          if name["="]
    Severity: Minor
    Found in lib/cf/cli/app/env.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 unmap_domain has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def unmap_domain
          domain = input[:domain]
    
          given_org = input.has?(:organization)
          given_space = input.has?(:space)
    Severity: Minor
    Found in lib/cf/cli/domain/unmap.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 curl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def curl
          mode = input[:mode].upcase
          path = input[:path]
          body = input[:body]
    
    
    Severity: Minor
    Found in lib/admin/curl.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 spaces has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def spaces
            spaces =
              with_progress("Getting spaces in #{c(org.name, :name)}") do
                org.spaces(:depth => quiet? ? 0 : 1).sort_by(&:name)
              end
    Severity: Minor
    Found in lib/cf/cli/space/spaces.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 instances has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def instances
          apps = input[:apps]
          fail "No applications given." if apps.empty?
    
          spaced(apps) do |app|
    Severity: Minor
    Found in lib/cf/cli/app/instances.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 org has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def org
          org = input[:organization]
    
          unless org
            return if quiet?
    Severity: Minor
    Found in lib/cf/cli/organization/org.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 switch_mode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def switch_mode(app, mode)
          mode = "run" if mode == "" # no value given
    
          return false if app.debug == mode
    
    
    Severity: Minor
    Found in lib/cf/cli/app/start.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 service_matches has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def service_matches(i, options)
          if app = options[:app]
            return false unless app.services.include? i
          end
    
    
    Severity: Minor
    Found in lib/cf/cli/service/services.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 ask_with_other has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def ask_with_other(message, all, choices, default, other)
    Severity: Minor
    Found in lib/cf/cli/app/push/interactions.rb - About 35 mins to fix

      Method open! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def open!
          if helper
            auth = helper_auth
      
            unless helper_healthy?(auth)
      Severity: Minor
      Found in lib/tunnel/tunnel.rb - About 35 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 domains has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def domains
            space = input[:space]
      
            domains =
              if input[:all]
      Severity: Minor
      Found in lib/cf/cli/domain/domains.rb - About 35 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 wrap_push has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def wrap_push(push, input)
          unless manifest
            create_and_save_manifest(push, input)
            return
          end
      Severity: Minor
      Found in lib/manifests/plugin.rb - About 35 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 ask_with_other has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def ask_with_other(message, all, choices, default, other)
            choices = choices.sort_by(&:name)
            choices << other if other
      
            opts = {
      Severity: Minor
      Found in lib/cf/cli/app/push/interactions.rb - About 35 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 create_services has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_services(app)
            return unless input[:create_services]
            finalize
            while true
              invoke :create_service, { :app => app }, :plan => :interact
      Severity: Minor
      Found in lib/cf/cli/app/push/create.rb - About 35 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 normalize_app! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def normalize_app!(app)
            if app.key?("mem")
              app["memory"] = app.delete("mem")
            end
      
      
      Severity: Minor
      Found in lib/manifests/loader/normalizer.rb - About 35 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 prettify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.prettify(client, outputter)
      
          target = nil
          version = nil
          current_user_email = nil
      Severity: Minor
      Found in lib/cf/cli/start/target_prettifier.rb - About 35 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 ordered_by_deps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def ordered_by_deps(apps, processed = Set[])
            ordered = []
            apps.each do |tag, info|
              next if processed.include?(tag)
      
      
      Severity: Minor
      Found in lib/manifests/loader/normalizer.rb - About 35 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

      Severity
      Category
      Status
      Source
      Language