lib/roma/event/handler.rb

Summary

Maintainability
D
1 day
Test Coverage

Method dispatcher has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

      def dispatcher
        @stats = Roma::Stats.instance
        #@log.debug("Roma::Event::Handler.dipatcher called")
        while(@connected) do
          @enter_time = nil
Severity: Minor
Found in lib/roma/event/handler.rb - About 6 hrs 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

Class Handler has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Handler < EventMachine::Connection
      @@ev_list={}
      def self.ev_list; @@ev_list; end
      @@system_commands={}
      def self.system_commands; @@system_commands; end
Severity: Minor
Found in lib/roma/event/handler.rb - About 2 hrs to fix

    Method dispatcher has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def dispatcher
            @stats = Roma::Stats.instance
            #@log.debug("Roma::Event::Handler.dipatcher called")
            while(@connected) do
              @enter_time = nil
    Severity: Major
    Found in lib/roma/event/handler.rb - About 2 hrs to fix

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

            def unbind
              @connected=false
              begin
                @fiber.resume
              rescue FiberError
      Severity: Minor
      Found in lib/roma/event/handler.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 read_bytes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def read_bytes(size, mult = 1)
              t=Time.now.to_i
              while(@connected) do
                d = pop(size)
                if d
      Severity: Minor
      Found in lib/roma/event/handler.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