chuckremes/ffi-rzmq

View on GitHub

Showing 9 of 17 total issues

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 deregister has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def deregister pollable, events
          return unless pollable
    
          item = @poll_items[pollable]
          if item && (item.events & events) > 0
    Severity: Minor
    Found in lib/ffi-rzmq/poll.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 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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def initialize context, link, size, count, stats
    Severity: Minor
    Found in examples/throughput_measurement.rb - About 35 mins to fix

      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

      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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(opts = {})
            if opts.respond_to?(:empty?)
              @io_threads = opts[:io_threads] || IO_THREADS_DFLT
              @max_sockets = opts[:max_sockets] || MAX_SOCKETS_DFLT
            else
      Severity: Minor
      Found in lib/ffi-rzmq/context.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