cloudfoundry/warden

View on GitHub
warden/lib/warden/server.rb

Summary

Maintainability
D
2 days
Test Coverage

File server.rb has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "warden/config"
require "warden/container"
require "warden/errors"
require "warden/event_emitter"
require "warden/network"
Severity: Minor
Found in warden/lib/warden/server.rb - About 5 hrs to fix

    Method run! has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.run!
          ::EM.epoll
    
          old_soft, old_hard = Process.getrlimit(:NOFILE)
          Process.setrlimit(Process::RLIMIT_NOFILE, 32768)
    Severity: Minor
    Found in warden/lib/warden/server.rb - About 1 hr to fix

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

          def self.recover_containers
            max_job_id = 0
      
            Dir.glob(File.join(container_klass.container_depot_path, "*")) do |path|
              if !File.exist?(container_klass.snapshot_path(path))
      Severity: Minor
      Found in warden/lib/warden/server.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 process has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def process(request)
              case request
              when Protocol::PingRequest
                response = request.create_response
                send_response(response)
      Severity: Minor
      Found in warden/lib/warden/server.rb - About 1 hr to fix

        Method run_machine has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def run_machine
                loop do
                  case @state
                  when State::INACTIVE, State::WAIT_ACCEPTOR_CLOSED
                    break
        Severity: Minor
        Found in warden/lib/warden/server.rb - About 1 hr to fix

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

              def self.recover_containers
                max_job_id = 0
          
                Dir.glob(File.join(container_klass.container_depot_path, "*")) do |path|
                  if !File.exist?(container_klass.snapshot_path(path))
          Severity: Minor
          Found in warden/lib/warden/server.rb - About 1 hr to fix

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

                  def process_container_request(request, container)
                    case request
                    when Protocol::StopRequest
                      if request.background
                        # Dispatch request out of band when the `background` flag is set
            Severity: Minor
            Found in warden/lib/warden/server.rb - About 1 hr to fix

              Method run_machine has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                    def run_machine
                      loop do
                        case @state
                        when State::INACTIVE, State::WAIT_ACCEPTOR_CLOSED
                          break
              Severity: Minor
              Found in warden/lib/warden/server.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 process_container_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def process_container_request(request, container)
                      case request
                      when Protocol::StopRequest
                        if request.background
                          # Dispatch request out of band when the `background` flag is set
              Severity: Minor
              Found in warden/lib/warden/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 receive_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def receive_request(req = nil)
                      @requests << req if req
              
                      # Don't start new request when old one hasn't finished, or the
                      # connection is about to be closed.
              Severity: Minor
              Found in warden/lib/warden/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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def process(request)
                      case request
                      when Protocol::PingRequest
                        response = request.create_response
                        send_response(response)
              Severity: Minor
              Found in warden/lib/warden/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

              There are no issues that match your filters.

              Category
              Status