cloudfoundry/vmc

View on GitHub

Showing 93 of 93 total issues

Method info has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def info
      all = input[:all]

      if all || input[:runtimes]
        runtimes =
Severity: Minor
Found in lib/vmc/cli/start/info.rb - About 6 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 service_matches has a Cognitive Complexity of 41 (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/vmc/cli/service/services.rb - About 6 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 CLI has 41 methods (exceeds 20 allowed). Consider refactoring.
Open

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

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

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

    require "yaml"
    require "socket"
    require "net/http"
    require "multi_json"
    require "fileutils"
    Severity: Minor
    Found in lib/vmc/cli.rb - About 4 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/vmc/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 info has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def info
            all = input[:all]
      
            if all || input[:runtimes]
              runtimes =
      Severity: Major
      Found in lib/vmc/cli/start/info.rb - About 3 hrs to fix

        Method unmap has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def unmap
              return invoke :v1_unmap, input.inputs, input.given unless v2?
        
              if input[:all]
                if input.has?(:app)
        Severity: Minor
        Found in lib/vmc/cli/route/unmap.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 map_route has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def map_route(app)
              line unless quiet?
        
              host = input[:host, app.name] if v2?
              domain = input[:domain, app]
        Severity: Minor
        Found in lib/vmc/cli/app/push/create.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 client has a Cognitive Complexity of 20 (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/vmc/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 login has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def login
              show_context
        
              credentials =
                { :username => input[:username],
        Severity: Minor
        Found in lib/vmc/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 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/vmc/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

        Method scale has a Cognitive Complexity of 19 (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/vmc/cli/app/scale.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 delete_org has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

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

            def get_inputs
              inputs = {}
              inputs[:name] = input[:name]
              inputs[:total_instances] = input[:instances]
              inputs[:space] = client.current_space if client.current_space
        Severity: Minor
        Found in lib/vmc/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_service has 44 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: Minor
        Found in lib/vmc/cli/service/create.rb - About 1 hr to fix

          Method services has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def services
                msg =
                  if space = input[:space]
                    "Getting services in #{c(space.name, :name)}"
                  else
          Severity: Minor
          Found in lib/vmc/cli/service/services.rb - About 1 hr to fix

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

                def self.load_all
                  # auto-load gems with 'vmc-plugin' in their name
                  matching =
                    if Gem::Specification.respond_to? :find_all
                      Gem::Specification.find_all do |s|
            Severity: Minor
            Found in lib/vmc/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 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def delete_space
                  org = input[:organization]
                  spaces = input[:spaces, org]
            
                  deleted_current = false
            Severity: Minor
            Found in lib/vmc/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 create_service has a Cognitive Complexity of 14 (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/vmc/cli/service/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 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/vmc/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

            Severity
            Category
            Status
            Source
            Language