cloudfoundry/vmc

View on GitHub

Showing 93 of 93 total issues

Method spaces has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

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

      def select_org(input, info)
        if input.has?(:organization) || !org_valid?(info[:organization])
          org = input[:organization]
          if org
            with_progress("Switching to organization #{c(org.name, :name)}") {}
Severity: Minor
Found in lib/vmc/cli/start/base.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/vmc/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 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/vmc/cli/app/push/interactions.rb - About 35 mins to fix

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

        def ask_space(org)
          spaces = org.spaces(:depth => 0)
    
          if spaces.empty?
            unless quiet?
    Severity: Minor
    Found in lib/vmc/cli/start/target_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 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/vmc/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 check_application has a Cognitive Complexity of 7 (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/vmc/cli/app/start.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 apply_changes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def apply_changes(app)
          app.memory = megabytes(input[:memory]) if input.has?(:memory)
          app.total_instances = input[:instances] if input.has?(:instances)
          app.command = input[:command] if input.has?(:command)
          app.production = input[:plan].upcase.start_with?("P") if input.has?(:plan)
    Severity: Minor
    Found in lib/vmc/cli/app/push/sync.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 logs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def logs
          app = input[:app]
    
          instances =
            if input[:all] || input[:instance] == "all"
    Severity: Minor
    Found in lib/vmc/cli/app/logs.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/vmc/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 clear_space has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def clear_space(space)
          apps = space.apps
          services = space.service_instances
    
          return true if apps.empty? && services.empty?
    Severity: Minor
    Found in lib/vmc/cli/space/delete.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]
    
          while true
            invoke :create_service, { :app => app }, :plan => :interact
    Severity: Minor
    Found in lib/vmc/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 display_service has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def display_service(i)
          if quiet?
            line i.name
          elsif v2?
            plan = i.service_plan
    Severity: Minor
    Found in lib/vmc/cli/service/service.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_organization has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def ask_organization
          orgs = client.organizations(:depth => 0)
    
          if orgs.empty?
            unless quiet?
    Severity: Minor
    Found in lib/vmc/cli/start/target_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 determine_runtime has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def determine_runtime(framework)
          return input[:runtime] if input.has?(:runtime)
    
          detected_runtimes =
            if framework.name == "standalone"
    Severity: Minor
    Found in lib/vmc/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

    Avoid too many return statements within this method.
    Open

            return false unless File.fnmatch(provider, plan.service.provider)
    Severity: Major
    Found in lib/vmc/cli/service/services.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                return false unless File.fnmatch(version, i.version)
      Severity: Major
      Found in lib/vmc/cli/service/services.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return false unless File.fnmatch(plan.upcase, plan.name.upcase)
        Severity: Major
        Found in lib/vmc/cli/service/services.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return false unless File.fnmatch(version, plan.service.version)
          Severity: Major
          Found in lib/vmc/cli/service/services.rb - About 30 mins to fix

            Method precondition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def precondition
                  check_target
                  check_logged_in
            
                  return unless v2?
            Severity: Minor
            Found in lib/vmc/cli.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

            Severity
            Category
            Status
            Source
            Language