cloudfoundry/cf

View on GitHub

Showing 96 of 102 total issues

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/cf/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

Avoid too many return statements within this method.
Open

    return no_apps if fail_without_app && apps.empty?
Severity: Major
Found in lib/manifests/plugin.rb - About 30 mins to fix

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

        def stream_start_log(log)
          offset = 0
    
          while true
            begin
    Severity: Minor
    Found in lib/cf/cli/app/start.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

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

        def display_user(u)
          if quiet?
            puts u.email
          else
            line "#{c(u.email, :name)}:"
    Severity: Minor
    Found in lib/cf/cli/user/users.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

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

        def save_token_if_it_changes
          return yield unless client && client.token
    
          before_token = client.token
    
    
    Severity: Minor
    Found in lib/cf/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

    Method app_matches? has a Cognitive Complexity of 6 (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/cf/cli/app/apps.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

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

        def create_org
          org = client.organization
          org.name = input[:name]
          org.users = [client.current_user] if input[:add_self]
    
    
    Severity: Minor
    Found in lib/cf/cli/organization/create.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

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

        def display_tunnel_connection_info(info)
          line "Service connection info:"
    
          to_show = [nil, nil, nil] # reserved for user, pass, db name
          info.keys.each do |k|
    Severity: Minor
    Found in lib/tunnel/plugin.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

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

        def display_instance(i)
          start_line "instance #{c("\##{i.id}", :instance)}: "
          puts "#{b(c(i.state.downcase, state_color(i.state)))}"
    
          indented do
    Severity: Minor
    Found in lib/cf/cli/app/instances.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

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

        def start_local_prog(clients, command, info, port)
          client = clients[File.basename(command)]
    
          cmdline = "#{command} "
    
    
    Severity: Minor
    Found in lib/tunnel/plugin.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

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

        def display_service(i)
          if quiet?
            line i.name
          else
            plan = i.service_plan
    Severity: Minor
    Found in lib/cf/cli/service/service.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

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

        def running?
          vms = list
          if @platform == :windows
            vms.any? { |x|
              x.downcase == @vmx.downcase
    Severity: Minor
    Found in lib/micro/vmrun.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

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

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

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

        def stream_path(lines, instance, path)
          if verbose?
            lines << [instance, path, c("streaming...", :good) + "\n"]
          end
    
    
    Severity: Minor
    Found in lib/cf/cli/app/files.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

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

        def help
          if name = input[:command]
            if cmd = @@commands[name.gsub("-", "_").to_sym]
              Mothership::Help.command_help(cmd)
            else
    Severity: Minor
    Found in lib/cf/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

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

        def stop
          apps = input[:all] ? client.apps : input[:apps]
          fail "No applications given." if apps.empty?
    
          apps.each do |app|
    Severity: Minor
    Found in lib/cf/cli/app/stop.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