chuckremes/ffi-rzmq

View on GitHub

Showing 17 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      def initialize context, link, size, count
        @context = context
        @link = link
        @size = size
        @count = count
    Severity: Minor
    Found in examples/latency_measurement.rb and 1 other location - About 1 hr to fix
    examples/latency_measurement.rb on lines 75..92

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      def initialize context, link, size, count
        @context = context
        @link = link
        @size = size
        @count = count
    Severity: Minor
    Found in examples/latency_measurement.rb and 1 other location - About 1 hr to fix
    examples/latency_measurement.rb on lines 40..57

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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 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 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 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

      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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        def self.path( *args, &block )
          rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)
          if block
            begin
              $LOAD_PATH.unshift PATH
      Severity: Minor
      Found in lib/ffi-rzmq.rb and 1 other location - About 20 mins to fix
      lib/ffi-rzmq.rb on lines 18..28

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 27.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        def self.libpath( *args, &block )
          rv =  args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
          if block
            begin
              $LOAD_PATH.unshift LIBPATH
      Severity: Minor
      Found in lib/ffi-rzmq.rb and 1 other location - About 20 mins to fix
      lib/ffi-rzmq.rb on lines 35..45

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 27.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      begin
        ctx = ZMQ::Context.new
        s1 = ctx.socket(ZMQ::REQ)
        s2 = ctx.socket(ZMQ::REP)
      rescue ContextError => e
      Severity: Minor
      Found in examples/reqrep_poll.rb and 3 other locations - About 15 mins to fix
      examples/local_lat_poll.rb on lines 17..24
      examples/request_response.rb on lines 10..17
      examples/xreqxrep_poll.rb on lines 11..18

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      begin
        ctx = ZMQ::Context.new
        s1 = ctx.socket(ZMQ::REQ)
        s2 = ctx.socket(ZMQ::REP)
      rescue ContextError => e
      Severity: Minor
      Found in examples/request_response.rb and 3 other locations - About 15 mins to fix
      examples/local_lat_poll.rb on lines 17..24
      examples/reqrep_poll.rb on lines 10..17
      examples/xreqxrep_poll.rb on lines 11..18

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      begin
        ctx = ZMQ::Context.new
        s1 = ctx.socket(ZMQ::REQ)
        s2 = ctx.socket(ZMQ::REP)
      rescue ContextError => e
      Severity: Minor
      Found in examples/local_lat_poll.rb and 3 other locations - About 15 mins to fix
      examples/reqrep_poll.rb on lines 10..17
      examples/request_response.rb on lines 10..17
      examples/xreqxrep_poll.rb on lines 11..18

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      begin
        ctx = ZMQ::Context.new
        s1 = ctx.socket(ZMQ::XREQ)
        s2 = ctx.socket(ZMQ::XREP)
      rescue ContextError => e
      Severity: Minor
      Found in examples/xreqxrep_poll.rb and 3 other locations - About 15 mins to fix
      examples/local_lat_poll.rb on lines 17..24
      examples/reqrep_poll.rb on lines 10..17
      examples/request_response.rb on lines 10..17

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language