eventmachine/eventmachine

View on GitHub

Showing 131 of 147 total issues

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

                    def receive_header_line ln
                      if ln.length == 0
                        if @header_lines.length > 0
                          process_header
                        else
            Severity: Minor
            Found in lib/em/protocols/httpclient2.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 eventable_write has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def eventable_write
                  # coalesce the outbound array here, perhaps
                  @last_activity = Reactor.instance.current_loop_time
                  while data = @outbound_q.shift do
                    begin
            Severity: Minor
            Found in lib/em/pure_ruby.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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def run
                  raise Error.new( "already running" ) if @running
                  @running = true
            
                  begin
            Severity: Minor
            Found in lib/em/pure_ruby.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 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

            Method writeOutboundData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public boolean writeOutboundData() throws IOException {
                    ByteBuffer[] bufs = new ByteBuffer[64];
                    int i;
                    long written, toWrite;
                    while (!outboundQ.isEmpty()) {
            Severity: Minor
            Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - About 1 hr to fix

              Method process_rcpt_to has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def process_rcpt_to rcpt
                      unless @state.include?(:mail_from)
                        send_data "503 MAIL is required before RCPT\r\n"
                      else
                        succeeded = proc {
              Severity: Minor
              Found in lib/em/protocols/smtpserver.rb - About 1 hr to fix

                Method consume_line has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def consume_line line
                          if @state == :precommand
                            unless line =~ /\A\s*\Z/
                              @command = line
                              @state = :headers
                Severity: Minor
                Found in lib/em/protocols/stomp.rb - About 1 hr to fix

                  Method invoke_rcpt_to has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def invoke_rcpt_to
                          @rcpt_responses ||= []
                          l = @rcpt_responses.length
                          to = @args[:to].is_a?(Array) ? @args[:to] : [@args[:to].to_s]
                          if l < to.length
                  Severity: Minor
                  Found in lib/em/protocols/smtpclient.rb - About 55 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 dispatch_conn_message has a Cognitive Complexity of 9 (exceeds 5 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 55 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 nameservers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def self.nameservers
                          return @nameservers if @nameservers
                  
                          if windows?
                            _, ns = Win32::Resolv.get_resolv_info
                  Severity: Minor
                  Found in lib/em/resolver.rb - About 55 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 process_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def process_data
                          unless @state.include?(:rcpt)
                            send_data "503 Operation sequence error\r\n"
                          else
                            succeeded = proc {
                  Severity: Minor
                  Found in lib/em/protocols/smtpserver.rb - About 55 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 dispatchInboundData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public ByteBuffer dispatchInboundData (ByteBuffer bb) throws SSLException {
                          if (sslEngine != null) {
                              if (true) throw new RuntimeException ("TLS currently unimplemented");
                              System.setProperty("javax.net.debug", "all");
                              ByteBuffer w = ByteBuffer.allocate(32*1024); // TODO, WRONG, preallocate this buffer.
                  Severity: Minor
                  Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - 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 isReadable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      void isReadable (SelectionKey k) {
                          EventableChannel ec = (EventableChannel) k.attachment();
                          long b = ec.getBinding();
                  
                          if (ec.isWatchOnly()) {
                  Severity: Minor
                  Found in java/src/com/rubyeventmachine/EmReactor.java - 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

                  Avoid deeply nested control flow statements.
                  Open

                    add_define 'WITH_SSL' if find_openssl_library
                  Severity: Major
                  Found in ext/extconf.rb - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language