cloudfoundry/cf

View on GitHub

Showing 102 of 102 total issues

Method apps_in_manifest has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def apps_in_manifest(input = nil, use_name = true, &blk)
    names_or_paths =
      if input.has?(:apps)
        # names may be given but be [], which will still cause
        # interaction, so use #direct instead of #[] here
Severity: Minor
Found in lib/manifests/manifests.rb - About 1 hr to fix

    Method apps has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def apps
          if space = input[:space]
            begin
              space.summarize!
            rescue CFoundry::APIError
    Severity: Minor
    Found in lib/cf/cli/app/apps.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 start has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

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

          def get_object
            previous_object = client.send(type, (info[type])) if info[type]
    
            if input.has?(type)
              if respond_to?(:finder_argument, true)
    Severity: Minor
    Found in lib/cf/cli/populators/populator_methods.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 map_route has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def map_route(app)
          line unless quiet?
    
          host = input[:host, app.name]
          finalize
    Severity: Minor
    Found in lib/cf/cli/app/push/create.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 create_manifest_for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def create_manifest_for(app, path)
        meta = {
          "name" => app.name,
          "memory" => human_size(app.memory * 1024 * 1024, 0),
          "instances" => app.total_instances,
    Severity: Minor
    Found in lib/manifests/manifests.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 stats has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def stats
          app = input[:app]
          stats =
            with_progress("Getting stats for #{c(app.name, :name)}") do |s|
              begin
    Severity: Minor
    Found in lib/cf/cli/app/stats.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 delete_org has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def delete_org
          org = input[:organization]
          return unless input[:really, org]
    
          is_current = org == client.current_organization
    Severity: Minor
    Found in lib/cf/cli/organization/delete.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 get_connection_info has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_connection_info(token)
        response = nil
        10.times do
          begin
            response =
    Severity: Minor
    Found in lib/tunnel/tunnel.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 unmap has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def unmap
          if input[:all]
            if input.has?(:app)
              app = target = input[:app]
            else
    Severity: Minor
    Found in lib/cf/cli/route/unmap.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 space has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def space
            space = CF::Populators::Space.new(input, org).populate_and_save!
    
            unless space
              return if quiet?
    Severity: Minor
    Found in lib/cf/cli/space/space.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 tunnel has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def tunnel
          instances = client.service_instances
          fail "No services available for tunneling." if instances.empty?
    
          instance = input[:instance, instances.sort_by(&:name)]
    Severity: Minor
    Found in lib/tunnel/plugin.rb - About 1 hr to fix

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

          def log_error(e)
            ensure_config_dir
      
            msg = e.class.name
            msg << ": #{e}" unless e.to_s.empty?
      Severity: Minor
      Found in lib/cf/cli.rb - About 1 hr to fix

        Method curl has 28 lines of code (exceeds 25 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 1 hr to fix

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

              def bind_services(app)
                return unless input[:bind_services]
          
                while true
                  invoke :bind_service, :app => app
          Severity: Minor
          Found in lib/cf/cli/app/push/create.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 tunnel has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def tunnel
                instances = client.service_instances
                fail "No services available for tunneling." if instances.empty?
          
                instance = input[:instance, instances.sort_by(&:name)]
          Severity: Minor
          Found in lib/tunnel/plugin.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 delete_space has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def delete_space
                space = input[:space, org]
          
                return unless input[:really, space]
          
          
          Severity: Minor
          Found in lib/cf/cli/space/delete.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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def login(auth = get_credentials)
              if !auth["username"] || !auth["password"]
                raise "Unable to verify console credentials."
              end
          
          
          Severity: Minor
          Found in lib/console/console.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 log_error has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def log_error(e)
                ensure_config_dir
          
                msg = e.class.name
                msg << ": #{e}" unless e.to_s.empty?
          Severity: Minor
          Found in lib/cf/cli.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 create_space has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def create_space
                  space = client.space
                  space.organization = org
                  space.name = input[:name]
          
          
          Severity: Minor
          Found in lib/cf/cli/space/create.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

          Severity
          Category
          Status
          Source
          Language