redjazz96/nova

View on GitHub
lib/nova/project.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

There are no issues that match your filters.

Category
Status