ryotarai/infrataster

View on GitHub

Method response has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def response
        server.forward_port(resource.uri.port) do |address, port|
          url = "#{resource.uri.scheme}://#{address}:#{port}"
          options = {:url => url}

Severity: Minor
Found in lib/infrataster/contexts/http_context.rb - About 1 hr to fix

    Method define has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def define(name, *args, &block)
            address = args.shift
            options = args.any? ? args.shift : {}
            if block
              st = OpenStruct.new
    Severity: Minor
    Found in lib/infrataster/server.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 response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def response
            server.forward_port(resource.uri.port) do |address, port|
              url = "#{resource.uri.scheme}://#{address}:#{port}"
              options = {:url => url}
    
    
    Severity: Minor
    Found in lib/infrataster/contexts/http_context.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 _ssh_start_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _ssh_start_args
          config = {}
    
          if @options[:ssh]
            config = @options[:ssh]
    Severity: Minor
    Found in lib/infrataster/server.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 fetch_all_addresses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetch_all_addresses
          result = []
          uname = ssh_exec('uname -s')
          case uname
          when /(FreeBSD|OpenBSD)/
    Severity: Minor
    Found in lib/infrataster/server.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

    Severity
    Category
    Status