tamashii-io/tamashii

View on GitHub

Showing 5 of 5 total issues

Method process has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

        def process(monitors)
          monitors.each do |monitor|
            io = monitor.io
            stream = monitor.value

Severity: Minor
Found in lib/tamashii/server/connection/stream_event_loop.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 flush_write_buffer has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def flush_write_buffer
          @write_lock.synchronize do
            loop do
              return true if @write_buffer.empty? && @write_head.nil?
              @write_head = @write_buffer.pop if @write_head.nil?
Severity: Minor
Found in lib/tamashii/server/connection/stream.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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def run
          loop do
            if stopped?
              @nio.close
              break
Severity: Minor
Found in lib/tamashii/server/connection/stream_event_loop.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

Avoid too many return statements within this method.
Open

          return true if env['rack.url_scheme'] == 'https'
Severity: Major
Found in lib/tamashii/server/connection/client_socket.rb - About 30 mins to fix

    Method spawn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def spawn
              return if @thread && @thread.status
    
              @spawn_mutex.synchronize do
                return if @thread && @thread.status
    Severity: Minor
    Found in lib/tamashii/server/connection/stream_event_loop.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