cloudfoundry/vmc

View on GitHub

Showing 93 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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      if frameworks
                        line unless quiet?
                
                        if frameworks.empty? && !quiet?
                          line "#{d("none")}"
                Severity: Minor
                Found in lib/vmc/cli/start/info.rb and 1 other location - About 55 mins to fix
                lib/vmc/cli/start/info.rb on lines 64..79

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 46.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      if runtimes
                        line unless quiet?
                
                        if runtimes.empty? && !quiet?
                          line "#{d("none")}"
                Severity: Minor
                Found in lib/vmc/cli/start/info.rb and 1 other location - About 55 mins to fix
                lib/vmc/cli/start/info.rb on lines 82..97

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 46.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                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

                Severity
                Category
                Status
                Source
                Language