eventmachine/eventmachine

View on GitHub

Showing 121 of 147 total issues

Method isWritable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    void isWritable (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

Method bind_connect has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def self.bind_connect bind_addr, bind_port, server, port=nil, handler=nil, *args
Severity: Minor
Found in lib/eventmachine.rb - About 45 mins to fix

    Method run_deferred_callbacks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.run_deferred_callbacks
        until (@resultqueue ||= []).empty?
          result,cback = @resultqueue.pop
          cback.call result if cback
        end
    Severity: Minor
    Found in lib/eventmachine.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 receive_line has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def receive_line line
            @stomp_initialized || init_message_reader
            @stomp_message.consume_line(line) {|outcome|
              if outcome.first == :sized_text
                set_text_mode outcome[1]
    Severity: Minor
    Found in lib/em/protocols/stomp.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 send_cmd has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def send_cmd cmd, key, flags = 0, exptime = 0, bytes = 0, noreply = false
    Severity: Minor
    Found in lib/em/protocols/memcache.rb - About 45 mins to fix

      Method receive_chunk_header has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def receive_chunk_header ln
                if ln.length > 0
                  chunksize = ln.to_i(16)
                  if chunksize > 0
                    @conn.set_text_mode(ln.to_i(16))
      Severity: Minor
      Found in lib/em/protocols/httpclient2.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 handshake_complete? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def handshake_complete?
            if !@handshake_complete && io.respond_to?(:state)
              if io.state =~ /^SSLOK/
                @handshake_complete = true
                EventMachine::event_callback uuid, SslHandshakeCompleted, ""
      Severity: Minor
      Found in lib/em/pure_ruby.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 sendDatagram has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          void sendDatagram (long sig, byte[] data, int length, String recipAddress, int recipPort);
      Severity: Minor
      Found in java/src/com/rubyeventmachine/EmReactorInterface.java - About 35 mins to fix

        Method send_datagram has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def send_datagram target, data, datalength, host, port
        Severity: Minor
        Found in lib/em/pure_ruby.rb - About 35 mins to fix

          Method connect has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def self.connect server, port=nil, handler=nil, *args, &blk
          Severity: Minor
          Found in lib/eventmachine.rb - About 35 mins to fix

            Method send_datagram has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def self.send_datagram sig, data, length, address, port
            Severity: Minor
            Found in lib/jeventmachine.rb - About 35 mins to fix

              Method sendDatagram has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public void sendDatagram(long sig, byte[] data, int length, String recipAddress, int recipPort)
              Severity: Minor
              Found in java/src/com/rubyeventmachine/NullEmReactor.java - About 35 mins to fix

                Method start_server has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def self.start_server server, port=nil, handler=nil, *args, &block
                Severity: Minor
                Found in lib/eventmachine.rb - About 35 mins to fix

                  Method sendDatagram has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public void sendDatagram (long sig, byte[] data, int length, String recipAddress, int recipPort) {
                  Severity: Minor
                  Found in java/src/com/rubyeventmachine/EmReactor.java - About 35 mins to fix

                    Method removeUnboundConnections has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        void removeUnboundConnections() {
                            ListIterator<Long> iter = UnboundConnections.listIterator(0);
                            while (iter.hasNext()) {
                                long b = iter.next();
                    
                    
                    Severity: Minor
                    Found in java/src/com/rubyeventmachine/EmReactor.java - 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 process_starttls has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def process_starttls
                            if @@parms[:starttls]
                              if @state.include?(:starttls)
                                send_data "503 TLS Already negotiated\r\n"
                              elsif ! @state.include?(:ehlo)
                    Severity: Minor
                    Found in lib/em/protocols/smtpserver.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 checkIO has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        void checkIO() {
                            long timeout;
                    
                            if (NewConnections.size() > 0) {
                                timeout = -1;
                    Severity: Minor
                    Found in java/src/com/rubyeventmachine/EmReactor.java - 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 request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def request args
                            args[:host_header] = @host_header unless args.has_key?(:host_header)
                            args[:authorization] = @authorization unless args.has_key?(:authorization)
                            r = Request.new self, args
                            if @closed
                    Severity: Minor
                    Found in lib/em/protocols/httpclient2.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 addNewConnections has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        void addNewConnections() {
                            ListIterator<EventableSocketChannel> iter = DetachedConnections.listIterator(0);
                            while (iter.hasNext()) {
                                EventableSocketChannel ec = iter.next();
                                ec.cleanup();
                    Severity: Minor
                    Found in java/src/com/rubyeventmachine/EmReactor.java - 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 attach_io has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def EventMachine::attach_io io, watch_mode, handler=nil, *args
                        klass = klass_from_handler(Connection, handler, *args)
                    
                        if !watch_mode and klass.public_instance_methods.any?{|m| [:notify_readable, :notify_writable].include? m.to_sym }
                          raise ArgumentError, "notify_readable/writable with EM.attach is not supported. Use EM.watch(io){ |c| c.notify_readable = true }"
                    Severity: Minor
                    Found in lib/eventmachine.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

                    Severity
                    Category
                    Status
                    Source
                    Language