jgraichen/rbzmq

View on GitHub

Showing 5 of 5 total issues

Method poll has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def poll(timeout, &block)
      mutex.synchronize do
        if @poll_items.any?
          ready_items = do_poll(convert_timeout(timeout))

Severity: Minor
Found in lib/rbzmq/poller.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 deregister has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def deregister(pollable, events = ZMQ::POLLIN | ZMQ::POLLOUT)
      return unless pollable

      mutex.synchronize do
        item = @poll_items[pollable]
Severity: Minor
Found in lib/rbzmq/poller.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(rc, errno = nil, message = nil)
      if ZMQ::ZeroMQError === rc
        @rc      = rc.result_code
        @errno   = rc.error_code
        @message = rc.message =~ /msg\s+\[(.*?)\]/ ? $1 : 'Unknown'
Severity: Minor
Found in lib/rbzmq/errors.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

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

    def recv(flags = 0, opts = {})
      opts, flags = flags, 0 if flags.is_a?(Hash)

      with_recv_timeout(opts) do
        messages = []
Severity: Minor
Found in lib/rbzmq/socket.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(type, opts = {})
      ctx = opts.fetch(:ctx) { RbZMQ::Context.global }
      ctx = ctx.pointer if ctx.respond_to? :pointer

      unless ctx.is_a?(FFI::Pointer)
Severity: Minor
Found in lib/rbzmq/socket.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