eventmachine/eventmachine

View on GitHub

Showing 121 of 147 total issues

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

def dir_config_wrapper(pretty_name, name, idefault=nil, ldefault=nil)
  inc, lib = dir_config(name, idefault, ldefault)
  if inc && lib
    unless idefault && ldefault
      abort "-----\nCannot find #{pretty_name} include path #{inc}\n-----" unless inc && inc.split(File::PATH_SEPARATOR).any? { |dir| File.directory?(dir) }
Severity: Minor
Found in ext/extconf.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 each has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def each(foreach=nil, after=nil, &blk)
      raise ArgumentError, 'proc or block required for iteration' unless foreach ||= blk
      raise RuntimeError, 'cannot iterate over an iterator more than once' if @started or @ended

      @started = true
Severity: Minor
Found in lib/em/iterator.rb - About 1 hr to fix

    Method process_header has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def process_header
              unless @header_lines.first =~ HttpResponseRE
                @conn.close_connection
                @internal_error = :bad_request
              end
    Severity: Minor
    Found in lib/em/protocols/httpclient2.rb - About 1 hr to fix

      Method process_cmd has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def process_cmd line
              case line.strip
              when /^VALUE\s+(.+?)\s+(\d+)\s+(\d+)/ # VALUE <key> <flags> <bytes>
                bytes = Integer($3)
                # set_binary_mode bytes+2
      Severity: Minor
      Found in lib/em/protocols/memcache.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 currentEvents has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private int currentEvents() {
              int events = 0;
      
              if (bWatchOnly)
              {
      Severity: Minor
      Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - 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 receive_data_response has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def receive_data_response
              return invoke_error unless @range == 3
      
              # The data to send can be given in either @args[:message], @args[:content], or the
              # combination of @args[:header] and @args[:body].
      Severity: Minor
      Found in lib/em/protocols/smtpclient.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 future has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.future arg, cb=nil, eb=nil, &blk
              arg = arg.call if arg.respond_to?(:call)
      
              if arg.respond_to?(:set_deferred_status)
                if cb || eb
      Severity: Minor
      Found in lib/em/future.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 bind_connect has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.bind_connect bind_addr, bind_port, server, port=nil, handler=nil, *args
          begin
            port = Integer(port)
          rescue ArgumentError, TypeError
            # there was no port, so server must be a unix domain socket
      Severity: Minor
      Found in lib/eventmachine.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 close has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          void close() {
              try {
                  if (mySelector != null)
                      mySelector.close();
              } catch (IOException e) {}
      Severity: Minor
      Found in java/src/com/rubyeventmachine/EmReactor.java - About 1 hr to fix

        Method receive_line has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def receive_line ln
                @@parms[:verbose] and $>.puts ">>> #{ln}"
        
                return process_data_line(ln) if @state.include?(:data)
                return process_auth_line(ln) if @state.include?(:auth_incomplete)
        Severity: Minor
        Found in lib/em/protocols/smtpserver.rb - About 1 hr to fix

          Method receive_data has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def receive_data data
                  if @lbp_mode == :lines
                    begin
                      @lpb_buffer.extract(data).each do |line|
                        receive_line(line.chomp) if respond_to?(:receive_line)
          Severity: Minor
          Found in lib/em/protocols/line_and_text.rb - About 1 hr to fix

            Method processIO has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                void processIO() {
                    Iterator<SelectionKey> it = mySelector.selectedKeys().iterator();
                    while (it.hasNext()) {
                        SelectionKey k = it.next();
                        it.remove();
            Severity: Minor
            Found in java/src/com/rubyeventmachine/EmReactor.java - 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 receive_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                  def receive_data data
                    @sasl_data << data
            
                    while @sasl_data.length > 2
                      len = (@sasl_data[0,2].unpack("n")).first
            Severity: Minor
            Found in lib/em/protocols/saslauth.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 writeOutboundData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public boolean writeOutboundData() {
                    while (!outboundQ.isEmpty()) {
                        Packet p = outboundQ.getFirst();
                        int written = 0;
                        try {
            Severity: Minor
            Found in java/src/com/rubyeventmachine/EventableDatagramChannel.java - 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 dispatch_conn_message has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def dispatch_conn_message msg
                    case msg
                    when AuthentificationClearTextPassword
                      raise ArgumentError, "no password specified" if @password.nil?
                      send_data PasswordMessage.new(@password).dump
            Severity: Minor
            Found in lib/em/protocols/postgres3.rb - About 1 hr to fix

              Method process_cmd has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def process_cmd line
                      case line.strip
                      when /^VALUE\s+(.+?)\s+(\d+)\s+(\d+)/ # VALUE <key> <flags> <bytes>
                        bytes = Integer($3)
                        # set_binary_mode bytes+2
              Severity: Minor
              Found in lib/em/protocols/memcache.rb - About 1 hr to fix

                Method receive_line has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def receive_line line
                        case @hc_mode
                        when :discard_blanks
                          unless line == ""
                            @hc_mode = :headers
                Severity: Minor
                Found in lib/em/protocols/header_and_content.rb - About 1 hr to fix

                  Method process_data_line has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def process_data_line ln
                          if ln == "."
                            if @databuffer.length > 0
                              receive_data_chunk @databuffer
                              @databuffer.clear
                  Severity: Minor
                  Found in lib/em/protocols/smtpserver.rb - About 1 hr to fix

                    Method isAcceptable has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        void isAcceptable (SelectionKey k) {
                            ServerSocketChannel ss = (ServerSocketChannel) k.channel();
                            SocketChannel sn;
                            long b;
                    
                    
                    Severity: Minor
                    Found in java/src/com/rubyeventmachine/EmReactor.java - About 1 hr to fix

                      Method receive_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def receive_data data
                              @data << data
                              while @data.length >= 5
                                pktlen = @data[1...5].unpack("N").first
                                if @data.length >= (1 + pktlen)
                      Severity: Minor
                      Found in lib/em/protocols/postgres3.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

                      Severity
                      Category
                      Status
                      Source
                      Language