cloudfoundry/vmc

View on GitHub

Showing 89 of 93 total issues

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

    Method wrap_errors has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def wrap_errors
          yield
        rescue CFoundry::Timeout => e
          err(e.message)
        rescue Interrupt
    Severity: Minor
    Found in lib/vmc/cli.rb - About 1 hr to fix

      Method service_matches has 30 lines of code (exceeds 25 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 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/vmc/cli.rb - About 1 hr to fix

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

              def create_space
                # TODO: ask org instead
                return invoke :help,
                  :command => "create-space" if input[:organization].nil?
          
          
          Severity: Minor
          Found in lib/vmc/cli/space/create.rb - About 1 hr to fix

            Method delete_service has 29 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/vmc/cli/service/delete.rb - About 1 hr to fix

              Method delete_org has 29 lines of code (exceeds 25 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 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/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 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/vmc/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 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/vmc/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 wrap_errors has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def wrap_errors
                      yield
                    rescue CFoundry::Timeout => e
                      err(e.message)
                    rescue Interrupt
                Severity: Minor
                Found in lib/vmc/cli.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/vmc/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 switch_mode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

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

                    def v1_unmap
                      app = input[:app]
                      url = input[:url, app.urls] unless input[:all]
                
                      with_progress("Updating #{c(app.name, :name)}") do |s|
                Severity: Minor
                Found in lib/vmc/cli/route/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 display_org_and_space has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def display_org_and_space
                      return unless v2?
                
                      if org = client.current_organization
                        line "organization: #{c(org.name, :name)}"
                Severity: Minor
                Found in lib/vmc/cli/start/target.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 display_apps_table has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def display_apps_table(apps)
                      table(
                        ["name", "status", "usage", v2? && "plan", "runtime", "url"],
                        apps.collect { |a|
                          [ c(a.name, :name),
                Severity: Minor
                Found in lib/vmc/cli/app/apps.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/vmc/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 crashes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def crashes
                      apps = input[:apps]
                      fail "No applications given." if apps.empty?
                
                      spaced(apps) do |app|
                Severity: Minor
                Found in lib/vmc/cli/app/crashes.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 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

                Severity
                Category
                Status
                Source
                Language