cloudfoundry/vmc

View on GitHub

Showing 89 of 93 total issues

Method delete_service has a Cognitive Complexity of 14 (exceeds 5 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

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 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def login
      show_context

      credentials =
        { :username => input[:username],
Severity: Minor
Found in lib/vmc/cli/start/login.rb - About 1 hr to fix

    Method delete has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def delete
          apps = client.apps
    
          if input[:all]
            return unless input[:really, "ALL APPS", :bad]
    Severity: Minor
    Found in lib/vmc/cli/app/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 services has a Cognitive Complexity of 13 (exceeds 5 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

    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 space has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def space
          org = input[:organization]
          space = input[:space, org]
    
          unless space
    Severity: Minor
    Found in lib/vmc/cli/space/space.rb - About 1 hr to fix

      Method display_app has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def display_app(a)
            status = app_status(a)
      
            line "#{c(a.name, :name)}: #{status}"
      
      
      Severity: Minor
      Found in lib/vmc/cli/app/app.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 app_matches? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def app_matches?(a, options)
            if name = options[:name]
              return false if a.name !~ /#{name}/
            end
      
      
      Severity: Minor
      Found in lib/vmc/cli/app/apps.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 tail has 35 lines of code (exceeds 25 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 1 hr to fix

        Method apps has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def apps
              if space = input[:space]
                begin
                  space.summarize!
                rescue CFoundry::APIError
        Severity: Minor
        Found in lib/vmc/cli/app/apps.rb - About 1 hr to fix

          Method stats has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def stats
                app = input[:app]
          
                stats =
                  with_progress("Getting stats for #{c(app.name, :name)}") do |s|
          Severity: Minor
          Found in lib/vmc/cli/app/stats.rb - About 1 hr to fix

            Method load_all has 32 lines of code (exceeds 25 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

              Method select_space has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                    def select_space(input, info, changed_org)
                      if input.has?(:space) || !space_valid?(info[:space])
                        line if changed_org && !quiet?
                        space = input[:space, client.current_organization]
                        if space
              Severity: Minor
              Found in lib/vmc/cli/start/base.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 handler has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def handler(event, state)
                    ans = state.answer
                    pos = state.position
              
                    exit if event == :eof
              Severity: Minor
              Found in lib/vmc/cli/interactive.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 target has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def target
                    unless input.has?(:url) || input.has?(:organization) || \
                            input.has?(:space)
                      display_target
                      display_org_and_space unless quiet?
              Severity: Minor
              Found in lib/vmc/cli/start/target.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 space has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

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

                  def stats
                    app = input[:app]
              
                    stats =
                      with_progress("Getting stats for #{c(app.name, :name)}") do |s|
              Severity: Minor
              Found in lib/vmc/cli/app/stats.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 apps has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def apps
                    if space = input[:space]
                      begin
                        space.summarize!
                      rescue CFoundry::APIError
              Severity: Minor
              Found in lib/vmc/cli/app/apps.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 start has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def start
                    apps = input[:all] ? client.apps : input[:apps]
                    fail "No applications given." if apps.empty?
              
                    spaced(apps) do |app|
              Severity: Minor
              Found in lib/vmc/cli/app/start.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 client has 31 lines of code (exceeds 25 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 1 hr to fix

                Method unmap has 31 lines of code (exceeds 25 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 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language