cloudfoundry/cf

View on GitHub

Showing 102 of 102 total issues

Class CLI has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

  class CLI < Mothership
    include CF::Interactive
    include CF::Spacing

    option :help, :desc => "Show command usage", :alias => "-h",
Severity: Minor
Found in lib/cf/cli.rb - About 6 hrs to fix

    File cli.rb has 383 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "yaml"
    require "socket"
    require "net/http"
    require "json/ext"
    require "multi_json"
    Severity: Minor
    Found in lib/cf/cli.rb - About 5 hrs to fix

      Method tabular has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def tabular(*rows)
            spacings = []
            rows.each do |row|
              next unless row
      
      
      Severity: Minor
      Found in lib/cf/spacing.rb - About 3 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 setup_services has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

        def setup_services(app, info)
          return if !info[:services] || info[:services].empty?
      
          offerings = client.services
      
      
      Severity: Minor
      Found in lib/manifests/manifests.rb - About 3 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 login has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def login
            show_context
      
            expected_prompts = if input[:sso]
              [:username, :passcode]
      Severity: Minor
      Found in lib/cf/cli/start/login.rb - About 2 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 apps_in_manifest has a Cognitive Complexity of 19 (exceeds 5 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 2 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 tail has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def tail
            app = input[:app]
      
            lines = Queue.new
            max_len = 0
      Severity: Minor
      Found in lib/cf/cli/app/files.rb - About 2 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

      Class VMrun has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class VMrun
          attr_reader :vmx, :vmrun
      
          def initialize(config)
            @platform = config[:platform]
      Severity: Minor
      Found in lib/micro/vmrun.rb - About 2 hrs to fix

        Class CFTunnel has 22 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class CFTunnel
          HELPER_NAME = "caldecott"
          HELPER_APP = File.expand_path("../helper-app", __FILE__)
        
          # bump this AND the version info reported by HELPER_APP/server.rb
        Severity: Minor
        Found in lib/tunnel/tunnel.rb - About 2 hrs to fix

          Method wrap_with_optional_name has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

            def wrap_with_optional_name(name_made_optional, cmd, input, fail_without_app)
              return cmd.call if input[:all]
          
              unless manifest
                # if the command knows how to handle this
          Severity: Minor
          Found in lib/manifests/plugin.rb - About 2 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 create_service has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              def create_service
                offerings = client.services
          
                if input[:provider]
                  offerings.reject! { |s| s.provider != input[:provider] }
          Severity: Minor
          Found in lib/cf/cli/service/create.rb - About 2 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 check_application has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_application(app)
                if app.debug == "suspend"
                  line "Application is in suspended debugging mode."
                  line "It will wait for you to attach to it before starting."
                  return
          Severity: Minor
          Found in lib/cf/cli/app/start.rb - About 2 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

          File manifests.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "yaml"
          require "set"
          require "cf/cli/service/create"
          
          require "manifests/loader"
          Severity: Minor
          Found in lib/manifests/manifests.rb - About 2 hrs to fix

            Method client has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def client(target = client_target)
                  return @@client if defined?(@@client) && @@client
                  return unless target
            
                  info = target_info(target)
            Severity: Minor
            Found in lib/cf/cli.rb - About 2 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 matches has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

              def matches(opts = {})
                service = opts[:service]
                plan = opts[:plan]
                provider = opts[:provider]
                version = opts[:version]
            Severity: Minor
            Found in lib/cf/cli/service/service_instance_helper.rb - About 2 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 create_service has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def create_service
                  offerings = client.services
            
                  if input[:provider]
                    offerings.reject! { |s| s.provider != input[:provider] }
            Severity: Major
            Found in lib/cf/cli/service/create.rb - About 2 hrs to fix

              Method login has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def login
                    show_context
              
                    expected_prompts = if input[:sso]
                      [:username, :passcode]
              Severity: Minor
              Found in lib/cf/cli/start/login.rb - About 1 hr to fix

                Method map_domain has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def map_domain
                      domain = client.domain_by_name(input[:name])
                
                      given_org = input.has?(:organization)
                      given_space = input.has?(:space)
                Severity: Minor
                Found in lib/cf/cli/domain/map.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 scale has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def scale
                      app = input[:app]
                
                      if input.has?(:instances)
                        instances = input[:instances, app.total_instances]
                Severity: Minor
                Found in lib/cf/cli/app/scale.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 load_all has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.load_all
                      # auto-load gems with 'cf-plugin' in their name
                      matching =
                        if Gem::Specification.respond_to? :find_all
                          Gem::Specification.find_all do |s|
                Severity: Minor
                Found in lib/cf/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

                Severity
                Category
                Status
                Source
                Language