redjazz96/nova

View on GitHub

Showing 11 of 13 total issues

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

        def wait_for_socket
          packet = nil

          while packet.nil? && run?

Severity: Minor
Found in lib/nova/starbound/protocol/socket.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 run_servers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def run_servers(do_fork = true, which = [])
      each_server(which) do |server, name|
        puts name

        if File.exists?(server[:files][:pid])
Severity: Minor
Found in lib/nova/project.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 shoot has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def shoot(which = [])
      each_server do |server, name|
        if File.exists?(server[:files][:pid])
          pid = File.open(server[:files][:pid], "r") { |f| f.read }.to_i

Severity: Minor
Found in lib/nova/project.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 grab_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def grab_file(file, options = {})
          uri = URI(file)
          dest = options[:to] || File.basename(uri.path)

          out = case uri.scheme.downcase
Severity: Minor
Found in lib/nova/remote/local/file_system.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 handle_client has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def handle_client(client)
      protocol = Protocol.new(
        @protocol_options.merge(:type => :server))

      protocol.socket = client
Severity: Minor
Found in lib/nova/starbound/server.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 read has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def read(read_check = true)
          pack = if @read.length > 0 && read_check
            @read.pop
          elsif threaded?
            queue.pop
Severity: Minor
Found in lib/nova/starbound/protocol/socket.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 each_server has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def each_server(only = [])
      server_list = [options["servers"], options["server"]].flatten.compact

      server_list.each_with_index do |srv, i|
        srv_name = srv.fetch(:name, "server#{i}")
Severity: Minor
Found in lib/nova/project.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 http_download has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def http_download(from, to)
          http = Net::HTTP.new(from.host, from.port)
          FileUtils.mkdir_p File.dirname(to)
          out = File.open(to, "wb")

Severity: Minor
Found in lib/nova/remote/local/file_system.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 build_server has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def build_server(server, redirect = true)
      if redirect
        Nova.logger = Logger.new(server[:files][:log], 10, 1_024_000)
        $stdin = $stdout = $stderr = File.open("/dev/null", "a")
      end
Severity: Minor
Found in lib/nova/project.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 run_star has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def run_star(target, data)
          return false unless authenticated?
          star = Star.from_target target

          return false unless star
Severity: Minor
Found in lib/nova/starbound/default_behavior/star_runnable.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 validate! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def validate!(remote)
          check_against :ruby do |ruby|
            if [:all, :any].include? ruby[:name]
              ruby[:version].satisfied_by?(
                Gem::Version.new(RUBY_VERSION))
Severity: Minor
Found in lib/nova/common/metadata/data.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