lib/midb/serverengine_controller.rb

Summary

Maintainability
D
2 days
Test Coverage

Method start has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring.
Open

      def start(port=8081)
        serv = TCPServer.new("localhost", port)
        MIDB::Interface::Server.info(:start, port)

        # Manage the requests
Severity: Minor
Found in lib/midb/serverengine_controller.rb - About 1 day 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 has 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def start(port=8081)
        serv = TCPServer.new("localhost", port)
        MIDB::Interface::Server.info(:start, port)

        # Manage the requests
Severity: Major
Found in lib/midb/serverengine_controller.rb - About 4 hrs to fix

Avoid deeply nested control flow statements.
Open

                    case endpoint.length
                    when 2
                      # No ID has been specified. Return all the entries
                      # Pass it to the model and get the JSON
                      MIDB::Interface::Server.info(:fetch, "get_all_entries()")
Severity: Major
Found in lib/midb/serverengine_controller.rb - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                  elsif method == "POST"
                    MIDB::Interface::Server.info(:fetch, "post(#{data})")
                    response_json = dbop.post(data).to_json
                  else
                    if endpoint.length >= 3
Severity: Major
Found in lib/midb/serverengine_controller.rb - About 45 mins to fix

There are no issues that match your filters.

Category
Status