chuckremes/ffi-rzmq

View on GitHub
lib/ffi-rzmq/socket.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Socket has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Socket
    attr_reader :socket, :name

    # Allocates a socket of type +type+ for sending and receiving data.
    #
Severity: Minor
Found in lib/ffi-rzmq/socket.rb - About 4 hrs to fix

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

        def send_multiple(parts, flags, method_name)
          if !parts || parts.empty?
            -1
          else
            flags = DONTWAIT if dontwait?(flags)
    Severity: Minor
    Found in lib/ffi-rzmq/socket.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 recvmsgs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def recvmsgs list, flag = 0
          flag = DONTWAIT if dontwait?(flag)
    
          message = @receiver_klass.new
          rc = recvmsg message, flag
    Severity: Minor
    Found in lib/ffi-rzmq/socket.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 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize context_ptr, type, opts = {:receiver_class => ZMQ::Message}
          # users may override the classes used for receiving; class must conform to the
          # same public API as ZMQ::Message
          @receiver_klass = opts[:receiver_class]
    
    
    Severity: Minor
    Found in lib/ffi-rzmq/socket.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 setsockopt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def setsockopt name, value, length = nil
          if 1 == @option_lookup[name]
            length = 8
            pointer = LibC.malloc length
            pointer.write_long_long value
    Severity: Minor
    Found in lib/ffi-rzmq/socket.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 sockopt_buffers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def sockopt_buffers option_type
          if 1 == option_type
            # int64_t or uint64_t
            @longlong_cache ||= alloc_pointer(:int64, 8)
    
    
    Severity: Minor
    Found in lib/ffi-rzmq/socket.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