eventmachine/eventmachine

View on GitHub

Showing 131 of 147 total issues

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

    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

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

                      def push(*items)
                        EM.schedule do
                          @sink.push(*items)
                          unless @popq.empty?
                            @drain = @sink
                  Severity: Minor
                  Found in lib/em/queue.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 schedule has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def schedule
                        EM.next_tick do
                          next if @stopped
                          if @work.call == :stop
                            stop
                  Severity: Minor
                  Found in lib/em/tick_loop.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 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

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

                  Avoid too many return statements within this method.
                  Open

                      return true
                  Severity: Major
                  Found in lib/eventmachine.rb - About 30 mins to fix

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

                          def receive_data data
                            (@buf ||= '') << data
                    
                            while @buf.size >= 4
                              if @buf.size >= 4+(size=@buf.unpack('N').first)
                    Severity: Minor
                    Found in lib/em/protocols/object_protocol.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

                    Method eventable_write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def eventable_write
                          40.times {
                            break if @outbound_q.empty?
                            begin
                              data,target = @outbound_q.first
                    Severity: Minor
                    Found in lib/em/pure_ruby.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